Why does the CDN have 2 // instead of http or https in front of the url

I don’t understand why I am looking at the following website for CDN, the URL starts with a double "//". I saw this on jQuery and Bootstrap. It depends on the person who should specify http: // or https: //?

http://www.bootstrapcdn.com/

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"> 
+6
source share
2 answers

This is the relative url:

If the browser views this current page via HTTPS, it will request this asset with the HTTPS protocol, otherwise it usually * requests it using HTTP. This prevents the error message “This page contains both protected and unprotected elements” in IE, storing all your resource requests within the same protocol.

+9
source

It's just like giving up a domain: href="/folder/file.html" , where browsers just accept the current domain.

In your case, the browser will accept the current protocol.

Absolute URLs omitting the protocol (scheme) to save one of the current page

+1
source

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


All Articles