Somewhat related question: It's fairly common for sites to have static files (images/css) served on a different (sub)domain. What are you supposed to do when the html content is being served on HTTPS? Should the static files be on HTTPS as well? If so, wouldn't it need a different certificate? Certificates are only valid for a single domain, after all.
'//www.your-cdn.com/image.jpg'
In other words don't specify http or https in the url, just do '//your-url.com/new.js'