4 ms·
Is there a reason to use https over a protocol-relative url? My go-to is <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
by imjared 13y ago
Is there a reason to use https over a protocol-relative url? My go-to is <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
- garfij 13y agoNo, protocol-relative is the way to go.
- sp332 13y agoI think HTTPS isn't a bad idea. You don't want some MITM messing with your 3rd-party JS.
- chrisbolt 13y agoIf you're loading your 3rd-party JS from an HTTP page, they already can.
- nicholaides 13y agoSure, but it's one less avenue for a MITM attack.
- pyre 13y agoSome older versions of IE don't like protocol-relative, IIRC. Depends on your target platform, and customer-base.
- Encosia 13y agoI've tested the protocol-relative URL in every version of IE that was available on Browsershots about a year ago (which went back even further than IE6, IIRC). None of them had trouble with it.
- pyre 13y agoI remember suggesting it to someone else at my previous employer and there were issues. It may have been Outlook[1] though. I can't recall off-hand. [1] http://stackoverflow.com/questions/4303633/preventing-secure-insecure-errors-by-using-protocol-relative-urls-for-image-sour http://stackoverflow.com/questions/4303633/preventing-secure...
- LocalPCGuy 13y agoTo clarify, IE6 and before. If you're target market doesn't include IE6, protocol-relative URLs work just fine.
- tszming 13y agoNot directly affecting jQuery/JavaScript, but when you use protocol relative URL all over the places, you need to be careful as Internet Explorer 7 & 8 will download stylesheets twice if the http(s) protocol is missing: http://www.stevesouders.com/blog/2010/02/10/5a-missing-schema-double-download/ http://www.stevesouders.com/blog/2010/02/10/5a-missing-schem...