最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Automatic selection : http or https javascript inclusion - Stack Overflow

programmeradmin1浏览0评论

Is it possible to automatically detect whether or not the page is accessed via http or https and then include a or ?

Is javascript included via https any different? I'm talking about cache age and so on?

Thanks, Wesley

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

Share Improve this question asked Nov 5, 2011 at 20:16 user429620user429620
Add a ment  | 

1 Answer 1

Reset to default 11

Use a protocol-relative link, starting with // instead of http or https:

<script type='text/javascript' src="//path/to/file.js"></script>
发布评论

评论列表(0)

  1. 暂无评论