Kir*_*sov 28 html hyperlink protocol-relative
越来越多的人开始注意到网站源代码中的链接以两个斜线开头.例如:
<a href="//example.com/1.png">Image</a>
为什么这样?
Mat*_*hen 38
它是协议相对URL(通常是HTTP或HTTPS).因此,如果我在上面http://example.org并且我链接(或包括图像,脚本等)//example.com/1.png,它就会发生http://example.com/1.png.如果我在https://example.org,它会去https://example.com/1.png.
http://example.org
//example.com/1.png
http://example.com/1.png
https://example.org
https://example.com/1.png
这使您可以轻松避免混合内容安全性错误.
归档时间:
14 年 前
查看次数:
5216 次
最近记录:
11 年,5 月 前