diff --git a/core/includes/common.inc b/core/includes/common.inc
index d21b9ce..c3565e9 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -2128,8 +2128,9 @@ function url($path = NULL, array $options = array()) {
     // before any / ? or #. Note: we could use url_is_external($path) here, but
     // that would require another function call, and performance inside url() is
     // critical.
+    $scheme_relative = strpos($path, '//') === 0;
     $colonpos = strpos($path, ':');
-    $options['external'] = ($colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && drupal_strip_dangerous_protocols($path) == $path);
+    $options['external'] = ($colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) || $scheme_relative) && drupal_strip_dangerous_protocols($path) == $path;
   }
 
   // Preserve the original path before altering or aliasing.
@@ -2221,10 +2222,11 @@ function url($path = NULL, array $options = array()) {
  */
 function url_is_external($path) {
   $colonpos = strpos($path, ':');
+  $scheme_relative = strpos($path, '//') === 0;
   // Avoid calling drupal_strip_dangerous_protocols() if there is any
   // slash (/), hash (#) or question_mark (?) before the colon (:)
   // occurrence - if any - as this would clearly mean it is not a URL.
-  return $colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && drupal_strip_dangerous_protocols($path) == $path;
+  return ($colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) || $scheme_relative) && drupal_strip_dangerous_protocols($path) == $path;
 }
 
 /**
