Double slash at the beginning of javascript includes

I looked at the html5 template and noticed that jquery includes a URL starting with a double slash. Url: //ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js

Why is http: missing?

+6
source share
2 answers

I hate answering with a link, but that explains it - http://paulirish.com/2010/the-protocol-relative-url/


Using a relative protocol URL, such as "// mydomain / myresource", ensures that the content will be served in the same way as the hosting page. This can make testing a little more inconvenient if you ever use FILE: // and then some remote locations, as they will obviously return to FILE. However, it allows mixed insecure / protected messages that you can trigger without using it.

+15
source

So, if access to .html is via HTTPS; the page will not have an insecure script.

0
source

Source: https://habr.com/ru/post/890548/


All Articles