diff --git media.admin.inc media.admin.inc
index 2c74b99..5b1343e 100644
--- media.admin.inc
+++ media.admin.inc
@@ -31,7 +31,7 @@ function media_admin($form, $form_state) {
   }
 
   require_once dirname(__FILE__) . '/media.browser.inc';
-  media_include_browser_js();
+  media_attach_browser_js($form);
   
   $types = media_display_types();
 
diff --git media.browser.inc media.browser.inc
index 543b9dc..16bda14 100644
--- media.browser.inc
+++ media.browser.inc
@@ -293,6 +293,31 @@ function _media_recursive_check_plain(&$value, $key) {
 }
 
 /**
+ * Attaches media browser javascript to an element.
+ *
+ * @param $element
+ *  The element array to attach to.
+ */
+function media_attach_browser_js(&$element) {
+  $element['#attached']['library'][] = array('media', 'media_browser');
+
+  $settings = array(
+    'browserUrl' => url('media/browser',
+      array('query' => array('render' => 'media-popup'))),
+    'styleSelectorUrl' => url('media/-media_id-/format-form',
+      array('query' => array('render' => 'media-popup'))),
+
+    // Adding src to blacklist; fid and view_mode we capture outside attribs so adding
+    // them too to the blacklist.
+    'blacklist' => array('src','fid','view_mode','format'), // Only applies to WYSIWG - should be removed;
+  );
+  $element['#attached']['js'][] = array(
+    'data' => array('media' => $settings),
+    'type' => 'setting',
+  );
+}
+
+/*
  * Prepares the page to be able to launch the media browser.
  *
  * @TODO: This is a WTF at present.  Basically, the browser is launched from wysiwyg
diff --git media.module media.module
index 9c804b9..8e6b6cc 100644
--- media.module
+++ media.module
@@ -1085,7 +1085,7 @@ function media_element_process(&$element, &$form_state, $form) {
   // All settings would likely apply to all media in a multi-value, but what about passing the existing fid?
 
   module_load_include('inc', 'media', 'media.browser');
-  media_include_browser_js();
+  media_attach_browser_js($element);
 
   return $element;
   // @todo: make this work for file and image fields
