HTTPS and external (CDN) hosted files?

Assuming the CDN provider has an https version, you can use protocol-relative URLs.

For example, instead of:

…you can use:


The browser will use the page’s protocol to try to obtain the file. On non-secure pages, http. On secure pages, https.

Google also makes YUI Loader available through its CDN. So for YUI this works fine:


…in both http and https contexts.

Leave a Comment