Reputation:
Is it possible to automatically detect whether or not the page is accessed via http or https and then include a https://url.js or http://url.js ?
Is javascript included via https any different? I'm talking about cache age and so on?
Thanks, Wesley
Upvotes: 2
Views: 4302
Reputation: 270647
Use a protocol-relative link, starting with //
instead of http or https
:
<script type='text/javascript' src="//path/to/file.js"></script>
Upvotes: 11