Possible Duplicate:
Is it valid to replace with // in a <script src=“…”>?
Links start with two slashes
I’ve seen this on a few sites now. An easy example is to look at the Wikipedia landing page’s source:
<link rel="shortcut icon" href="//en.wikipedia.org/favicon.ico" />
<link rel="apple-touch-icon" href="//upload.wikimedia.org/wikipedia/commons/f/f1/Wikipedia-mobile-icon.png" />
<link rel="copyright" href="//creativecommons.org/licenses/by-sa/3.0/" />
Is there some standard with starting external links with //? Is this just done to avoid having to download the extra https?: and save some characters because most browsers are smart enough to add the rest of the scheme on there own? Or is this a legitimate thing, maybe with some other reason?
That is usually called protocol-relative URLs and allows for the browser to download the resource using the same protocol as the page was being loaded with. So if the user had loaded the page through a
httpsurl, the resources specified with//will be loaded throughhttps, otherwise they are loaded through regularhttp.One thing it can help you prevent is the ugly user-unfriendly message in older versions of IE, stating that the page contains both secure and non-secure resources.
Paul Irish has written a good blog post about this: