diff --git a/admin_menu.inc b/admin_menu.inc
index aa63c81..d690544 100644
--- a/admin_menu.inc
+++ b/admin_menu.inc
@@ -891,11 +891,30 @@ function _admin_menu_flush_cache($name = NULL) {
 }
 
 /**
+ * Preprocess variables for theme_admin_menu_icon().
+ */
+function template_preprocess_admin_menu_icon(&$variables) {
+  if (theme_get_setting('toggle_favicon')) {
+    $src = theme_get_setting('favicon');
+    // Strip the protocol without delimiters for transient HTTP/HTTPS support.
+    // Since the menu is cached on the server-side and client-side, the cached
+    // version might contain a HTTP link, whereas the actual page is on HTTPS.
+    // Relative paths will work fine, but theme_get_setting() returns an
+    // absolute URI.
+    $src = preg_replace('@^https?:@', '', $src);
+  }
+  else {
+    $src = base_path() . 'misc/favicon.ico';
+  }
+  $variables['src'] = check_plain($src);
+}
+
+/**
  * Render an icon to display in the administration menu.
  *
  * @ingroup themeable
  */
-function theme_admin_menu_icon() {
-  return '<img class="admin-menu-icon" src="' . (theme_get_setting('toggle_favicon') ? theme_get_setting('favicon') : base_path() . 'misc/favicon.ico') . '" width="16" height="16" alt="' . t('Home') . '" />';
+function theme_admin_menu_icon($variables) {
+  return '<img class="admin-menu-icon" src="' . $variables['src'] . '" width="16" height="16" alt="' . t('Home') . '" />';
 }
 
diff --git a/admin_menu.module b/admin_menu.module
index 8ff2a64..30db139 100644
--- a/admin_menu.module
+++ b/admin_menu.module
@@ -51,7 +51,7 @@ function admin_menu_theme() {
       'render element' => 'elements',
     ),
     'admin_menu_icon' => array(
-      'variables' => array(),
+      'variables' => array('src' => NULL),
       'file' => 'admin_menu.inc',
     ),
   );
