Double slash at beginning of javascript include

后端 未结 2 1804
不知归路
不知归路 2021-01-18 15:06

I have been looking at the html5 boilerplate and noticed that the jquery include url starts with a double slash. The url is //ajax.googleapis.com/ajax/libs/jquery/1.5.1/jqu

相关标签:
2条回答
  • 2021-01-18 15:41

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


    Using a protocol relative URL like "//mydomain/myresource" will ensure that the content will be served via the same scheme as the hosting page. It can make testing a bit more awkward if you ever use FILE:// and then some remote locations as they will obviously resolve back to FILE. Never the less it does resolve the mixed insecure/secure content messages you can cause by not using it.

    0 讨论(0)
  • 2021-01-18 15:54

    So that if the .html is accessed via HTTPS; the page will not have any unsecured script.

    0 讨论(0)
提交回复
热议问题