Possible Duplicate:
Is it valid to replace with // in a <script src=“…”>?
I’ve been seeing sites linking to CSS and JS without the protocol more and more often lately:
<script src="//domain.cloudfront.net/file.js" type="text/javascript"></script>
And CSS
<link href="//domain.cloudfront.net/styles.css" media="screen" rel="stylesheet" type="text/css" />
Is this valid in all browsers? Does leaving off http or https mean the browser intelligently decides which protocol to use?
Yup. Paul Irish has a good blog entry about this. http://paulirish.com/2010/the-protocol-relative-url/
It’s basic purpose is to prevent those IE pop ups that warn you that some of the resources on the page are “non-secure” when your main protocol is https but you grab something with http.