Skip to main content

Is linking to CSS or JavaScript without the protocol supported in all browsers?



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?


Source: Tips4allCCNA FINAL EXAM

Comments

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

    ReplyDelete
  2. 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.

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?