7

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.com/

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
Old Man Programmer
  • 589
  • 3
  • 6
  • 14
  • 1
    possible duplicate of [Can I change all my http:// links to just //?](http://stackoverflow.com/questions/4831741/can-i-change-all-my-http-links-to-just) – Ian Jun 03 '13 at 18:55

2 Answers2

11

That 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.

John Conde
  • 217,595
  • 99
  • 455
  • 496
2

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

Community
  • 1
  • 1
Kevin Boucher
  • 16,426
  • 3
  • 48
  • 55