diff --git a/includes/MediaBrowserUpload.inc b/includes/MediaBrowserUpload.inc
index 03b5385..071d992 100644
--- a/includes/MediaBrowserUpload.inc
+++ b/includes/MediaBrowserUpload.inc
@@ -18,10 +18,14 @@ class MediaBrowserUpload extends MediaBrowserPlugin {
     }
 
     $upload_form = drupal_get_form($upload_form_id, $this->params);
-    return array(
+    $plugin = array(
       'form' => array($upload_form),
       '#attached' => $attached,
     );
+    // If we're redisplaying this form after a validation error, set it to be
+    // the active tab in the media browser.
+    $plugin['#settings']['active'] = media_form_has_errors($upload_form);
+    return $plugin;
   }
 
 }
diff --git a/includes/media.browser.inc b/includes/media.browser.inc
index 2d3bae7..f024e53 100644
--- a/includes/media.browser.inc
+++ b/includes/media.browser.inc
@@ -120,17 +120,26 @@ function media_browser($selected = NULL) {
     //Add any JS settings
     $browser_settings[$key] = isset($plugin['#settings']) ? $plugin['#settings'] : array();
 
-    // If this is a "ajax" style tab, add the href, otherwise an id.
-    $href = isset($plugin['#callback']) ? $plugin['#callback'] : "#media-tab-$key";
-    $tabs[] = "<a href='$href'><span>" . check_plain($plugins[$key]['title']) . "</span></a>";
+    $tab_id = "media-tab-$key";
+    if (isset($plugin['#callback'])) {
+      // If this is a "ajax" style tab, where the plugin provides a callback
+      // URL for the tab's content, add that callback URL to the link.
+      $href = $plugin['#callback'];
+    }
+    else {
+      // For regular plugins that provide HTML content, add a link fragment
+      // as the href, so jQuery UI Tabs has something to work with.
+      $href = '#' . $tab_id;
+    }
+    $tabs[] = "<a id='{$tab_id}-link' href='$href'><span>" . check_plain($plugins[$key]['title']) . "</span></a>";
 
     // Create a div for each tab's content.
     $plugin['#prefix'] = <<<EOS
-    <div class="media-browser-tab" id="media-tab-$key">
+    <div class="media-browser-tab" id="$tab_id">
 EOS;
     $plugin['#suffix'] = <<<EOS
     </div>
-    <!-- End #media-tab-$key -->
+    <!-- End #$tab_id -->
 EOS;
   }
 
diff --git a/js/media.browser.js b/js/media.browser.js
index 2aa9f9f..37e44d9 100644
--- a/js/media.browser.js
+++ b/js/media.browser.js
@@ -15,16 +15,34 @@ Drupal.media.browser.selectionFinalized = function (selectedMedia) {
 };
 
 Drupal.behaviors.experimentalMediaBrowser = {
-  attach: function (context) {
-    if (Drupal.settings.media.selectedMedia) {
+  attach: function (context, settings) {
+    var active, index, plugins, tabSettings;
+    if (settings.media.selectedMedia) {
       Drupal.media.browser.selectMedia(Drupal.settings.media.selectedMedia);
       // Fire a confirmation of some sort.
       Drupal.media.browser.finalizeSelection();
     }
-    $('#media-browser-tabset').tabs({
-      show: Drupal.media.browser.resizeIframe
+    // If one of the plugins has requested that its tab be active (after a
+    // validation error, for example) make that the active tab.
+    plugins = settings.media.browser;
+    $.each(plugins, function (pluginName) {
+      if (this.active) {
+        active = pluginName;
+      }
     });
-
+    tabSettings = {
+      show: Drupal.media.browser.resizeIframe
+    };
+    if (active) {
+      // To set a tab as selected, we have to first find its zero-based index
+      // within the list of tabs.
+      var tab = $('a#media-tab-' + active + '-link');
+      index = $('#media-browser-tabset a').index(tab);
+      if (index > -1) {
+        tabSettings.selected = index;
+      }
+    }
+    $('#media-browser-tabset', context).tabs(tabSettings);
     $('.media-browser-tab').each( Drupal.media.browser.validateButtons );
 
   }
diff --git a/media.module b/media.module
index 96199e6..26ebd25 100644
--- a/media.module
+++ b/media.module
@@ -1179,3 +1179,20 @@ function media_load_all_exports($module, $directory, $extension, $name = NULL) {
 
   return $return;
 }
+
+/**
+ * Helper function to determine whether a form has any errors.
+ */
+function media_form_has_errors($form) {
+  $error = form_get_error($form);
+  if (!empty($error)) {
+    return TRUE;
+  }
+  $children = element_children($form);
+  foreach ($children as $element) {
+    if (media_form_has_errors($form[$element])) {
+      return TRUE;
+    }
+  }
+  return FALSE;
+}
diff --git a/modules/media_internet/media_internet.module b/modules/media_internet/media_internet.module
index bab18ee..81f6b99 100644
--- a/modules/media_internet/media_internet.module
+++ b/modules/media_internet/media_internet.module
@@ -40,12 +40,16 @@ class MediaBrowserInternet extends MediaBrowserPlugin {
   function view() {
     // @todo: implement the multiselect argument here.
     $from_web_form = drupal_get_form('media_internet_add',  $this->params['types'], $this->params['multiselect']);
-    return array(
+    $plugin = array(
       'form' => array($from_web_form),
       '#attached' => array(
         //'js' => array($path . '/js/plugins/media.fromurl.js'),
       ),
     );
+    // If we're redisplaying this form after a validation error, set it to be
+    // the active tab in the media browser.
+    $plugin['#settings']['active'] = media_form_has_errors($from_web_form);
+    return $plugin;
   }
 
 }
@@ -134,10 +138,10 @@ function media_internet_add_validate($form, &$form_state) {
     $provider = media_internet_get_provider($embed_code);
     $provider->validate();
   } catch (MediaInternetNoHandlerException $e) {
-    form_set_error('url', $e->getMessage());
+    form_set_error('embed_code', $e->getMessage());
     return;
   } catch (MediaInternetValidationException $e) {
-    form_set_error('url', $e->getMessage());
+    form_set_error('embed_code', $e->getMessage());
     return;
   }
 
@@ -147,7 +151,7 @@ function media_internet_add_validate($form, &$form_state) {
     try {
       $file = $provider->getFileObject();
     } catch (Exception $e) {
-      form_set_error('url', $e->getMessage());
+      form_set_error('embed_code', $e->getMessage());
       return;
     }
 
@@ -164,7 +168,7 @@ function media_internet_add_validate($form, &$form_state) {
       else {
         $message .= ' ' . array_pop($errors);
       }
-      form_set_error('url', $message);
+      form_set_error('embed_code', $message);
       return FALSE;
     }
   }
@@ -198,12 +202,12 @@ function media_internet_add_submit($form, &$form_state) {
     $file = $provider->save();
   }
   catch (Exception $e) {
-    form_set_error('url', $e->getMessage());
+    form_set_error('embed_code', $e->getMessage());
     return;
   }
 
   if (!$file->fid) {
-    form_set_error('url', 'Unknown error: unable to add file, please check URL / Embed code and try again ' . $embed_code);
+    form_set_error('embed_code', t('Unknown error: unable to add file. Please check URL or embed code and try again.'));
     return;
   }
 
