A matter of protocol
The web is made of sugar, spice and all things nice. On closer inspection, this is what most URLs on the web are made of:
- The protocol—e.g.
http—followed by a colon and two slashes (for which Sir Tim apologises).
- The domain—e.g.
- The path—e.g.
(I’m leaving out the whole messy business of port numbers—which can be appended to the domain with a colon—because just about everything on the web is served over the default port 80.)
Most URLs on the web are either written in full as absolute URLs:
a href="http://adactio.com/journal/tags/nerdiness" script src="http://huffduffer.com/js/global.js"
Or else they’re written out relative to the domain, like this:
a href="/journal/tags/nerdiness" script src="/js/global.js"
It turns out that URLs can not only be written relative to the linking document’s domain, but they can also be written relative to the linking document’s protocol:
a href="//adactio.com/journal/tags/nerdiness" script src="//huffduffer.com/js/global.js"
If the linking document is being served over HTTP, then those URLs will point to
http://huffduffer.com/js/global.js but if the linking document is being served over HTTP Secure, the URLs resolve to
<!--[if lt IE 9]> <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"> </script>