带有两个斜杠并且没有模式的URL [英] Urls with two leading slashes and without schema
问题描述
有时我会看到脚本src或图像src没有模式,只有两个斜杠//
From http://www.performable.com/ 主页
< script src =// d2f7h8c8hc0u7y.cloudfront.net/performable/pax/8uEvsz.js\"> ;</script>
http://www.hellobar.com/ 主页 - 及其集成代码
<脚本类型=text / javascriptsrc =// www.hellobar.com/hellobar.js\"> ;</script>
我在我的网站上集成了这两个文件,并在apache日志中看到类似于
的错误 www.mysite.com//www.hellobar.com/hellobar.js找不到
然而,他们很少 - 不到1%。
我认为双重斜杠是替代品对于http \https和这样的链接将使用当前页面架构。有人可以证实吗?
另外,哪些浏览器支持该url,哪些有问题?解决方案
这在这里被多次讨论。是的,这是安全的,所有浏览器都支持这一点。
Sometimes I see script src or image src without schema, only two leading slashes //
From http://www.performable.com/ home page
<script src="//d2f7h8c8hc0u7y.cloudfront.net/performable/pax/8uEvsz.js"></script>
http://www.hellobar.com/ home page - and their integration code
<script type="text/javascript" src="//www.hellobar.com/hellobar.js"></script>
I've integrated both on my site and see errors in apache log similar to
www.mysite.com//www.hellobar.com/hellobar.js not found
However they're rare - less than 1%.
I think double leading slashes is a replacement for http\https and such links will use current page schema. Can someone confirm that?
Also, which browsers have support for that urls and which have problems?
This was discussed multiple times here. Yes it is safe and yes all browsers support this.
这篇关于带有两个斜杠并且没有模式的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!