在< script>的源代码中使用// [英] Using // in a <script>'s source
问题描述
我想知道是否有人在使用古老的http / https JavaScript < script>
hack时有任何资源,证据或个人经验:
I was wondering if anyone had any resources, proof, or personal experience in using the age-old http/https JavaScript <script>
hack:
<script src="//someserver.com/js/script.js"></script>
有没有人遇到任何这些浏览器的问题(IE 5.5 +,FF2 +,Chrome,Opera 9+ ,Safari 3+)?有没有人有过成功的故事?
Has anyone encountered issues in any of these browsers (IE 5.5+, FF2+, Chrome, Opera 9+, Safari 3+)? Has anybody had success stories?
推荐答案
所有现代浏览器都会理解这种格式,包括IE 6.(不确定IE 5.5) 。
All modern browsers will understand that format, including IE 6. (Not sure about IE 5.5).
实际上,这不是一个黑客,而是一个完全有效的URI语法,如 RFC 3986:第4.2节。因此,我说你很高兴。
Actually, this is not a hack, but a perfectly valid URI syntax as per RFC 3986: Section 4.2. Therefore, I say you're good to go.
这篇关于在< script>的源代码中使用//的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!