Possible Duplicate:
Can I change all my links to just //?
I've learnt that I can reference CSS and JavaScript by using the "//domain/path" format rather than being specific about whether the resource should be loaded over HTTP or HTTPS. Examples:
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
The browser then loads the resources using the same protocol (schema) as the current page.
Is this supported in all browsers, and if not, which browsers don't support it?
The browser parses the HTML and creates a DOM from it. Next, it parses the CSS. Since the only rule available in the CSS has a span selector, the browser sorts the CSS very quickly! It applies that rule to each one of the three <span> s, then paints the final visual representation to the screen.
CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements. Internal - by using a <style> element in the <head> section. External - by using a <link> element to link to an external CSS file.
When a web page is loaded, the browser first reads the HTML text and constructs DOM Tree from it. Then it processes the CSS whether that is inline, embedded, or external CSS and constructs the CSSOM Tree from it. After these trees are constructed, then it constructs the Render-Tree from it.
Yes, but IE 6-7 will download stylesheets twice with this method. Apart from that it works in all common browsers. See Can I change all my http:// links to just //?, Paul Irish - The protocol relative URL.
In general, it will work. There are edge cases in Everybody's Favorite Browser though, where if you're requesting from a non-ssl subdomain it will fail.
http://paulirish.com/2010/the-protocol-relative-url/
According to this article.
When used on a or @import for a stylesheet, IE7 and IE8 download the file twice. All other uses, however, are just fine.
And about IE 6
The reason this doesn't work in IE6 is that the server is using SNI to deduce what certificate to return. XP (and thus IE6) doesn't support SNI in the HTTPS stack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With