admin管理员组文章数量:1355540
I don't understand that why I look at the following website for a CDN, the URL's start with a double "//". I have seen this on JQuery and Bootstrap. Is it up to the person to put http:// or https://?
/
<link href="//netdna.bootstrapcdn/twitter-bootstrap/2.3.2/css/bootstrap-bined.min.css" rel="stylesheet">
I don't understand that why I look at the following website for a CDN, the URL's start with a double "//". I have seen this on JQuery and Bootstrap. Is it up to the person to put http:// or https://?
http://www.bootstrapcdn./
<link href="//netdna.bootstrapcdn./twitter-bootstrap/2.3.2/css/bootstrap-bined.min.css" rel="stylesheet">
Share
Improve this question
asked Jun 3, 2013 at 18:47
Old Man ProgrammerOld Man Programmer
5893 gold badges6 silver badges15 bronze badges
1
- 1 possible duplicate of Can I change all my http:// links to just //? – Ian Commented Jun 3, 2013 at 18:55
2 Answers
Reset to default 11That is a protocol relative URL:
If the browser is viewing that current page in through HTTPS, then it’ll request that asset with the HTTPS protocol, otherwise it’ll typically* request it with HTTP. This prevents that awful “This Page Contains Both Secure and Non-Secure Items” error message in IE, keeping all your asset requests within the same protocol.
It's just like omitting the domain: href="/folder/file.html"
where the browsers just assumes the current domain.
In your case the browser will assume the current protocol.
Absolute URLs omitting the protocol (scheme) in order to preserve the one of the current page
本文标签: javascriptWhy does the CDN39s have 2instead of http or https in front of the URLStack Overflow
版权声明:本文标题:javascript - Why does the CDN's have 2instead of http or https in front of the URL - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743954443a2567877.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论