链接以两个斜杠开头 [英] Links start with two slashes
本文介绍了链接以两个斜杠开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
越来越多,开始注意到网站上源代码中的链接以两个斜线开头.例如:
More and more, began to notice that the links in the source code on Web sites begin with two slashes. For example:
<a href="//example.com/1.png">Image</a>
为什么要这样做?
推荐答案
It's a protocol-relative URL (typically HTTP or HTTPS). So if I'm on http://example.org
and I link (or include an image, script, etc.) to //example.com/1.png
, it goes to http://example.com/1.png
. If I'm on https://example.org
, it goes to https://example.com/1.png
.
这可让您轻松避免混合内容安全错误.
This lets you easily avoid mixed content security errors.
这篇关于链接以两个斜杠开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文