Last Updated: February 25, 2016
·
727
· moak

load your cdn scripts with // to satisfy https

You just finished setting up https and yet the browser's aren't showing the sexy lock icon on your login or checkout?

Often when loading fonts or scripts from public CDNs we just copy paste the tag into our layouts and forget about it. Case in point jQuery's download page just tells you to include the http:// url. Instead of changing that to https you can just emit the protocol part entirely so it ends up looking like this

<script src="//code.jquery.com/jquery-1.10.1.min.js"></script>

Voila, on your encrypted pages it loads the encrypted version and on your regular pages it loads the regular version.

Of course the file needs to be available under https in order for this to work, so make sure to check the file can be reached.

3 Responses
Add your response

over 1 year ago ·

Thanks @tschuermans, good to know the correct term. Why am I not surprised this can break in IE6? Not that that would stop me :D

over 1 year ago ·

@moak What doesn't break in IE6? :p
btw useful statistics on IE6 => http://www.ie6countdown.com/

over 1 year ago ·