Lately I've noticed that a lot of web programming frameworks are using a //
in front of certain generated href
and src
links
//example from twitter.com
<a href="//support.twitter.com">Help</a>
Is this just a shortcut for http
/https
, or something more?
Does anyone know where this technique got its start and if there's a browser support matrix that confirms/describes the behavior of the leading //
?
It's protocol-relative URL best described by Paul Irish; http://paulirish.com/2010/the-protocol-relative-url/
Basically if you use protocol relative URL's (links that start with "//" instead of "http://" or "https://") you can avoid the "This Page Contains Both Secure and Non-Secure Items" pop-up in Internet Explorer (and possibly on other browsers as well). You can use that in .css files, too, simply by changing "http://" or "https://" to "//".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With