Lately I've noticed that some sites (such as jsFiddle) and some widgets such pinterest feed widget, and many others.
They started to use links in the format
//code.jquery.com/jquery-1.9.1.js
//assets.pinterest.com/js/pinit.js
//
means ? http
?//
is the same as http
why using it instead of http ?as addition: I'm not sure, but I think I've seem some use //name:sub.domaine.com
, am I wrong ? if those exist, what do they mean ?
as explained in an answer bellow, I can use the //
notation to make my links shorter, but when I use it for my website: Chrome changes the link to: file:///
which is not what I expected
This is a protocol-relative URL. If the page which includes it uses HTTP, then it's HTTP. If the page which includes it uses HTTPS, then it uses HTTPS.
This is convenient so that you can ensure that you don't fetch insecure resources in a secure page (this causes the "mixed content" warning you might have seen), without bothering with the overhead of SSL/TLS in a page which is delivered unencrypted anyhow.
It's similar to how URLs beginning with a single /
are resolved relative to the current protocol and hostname, and URLs with no leading /
or scheme are resolved relative to the current page's directory.
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