URL 以双斜线开头 [英] URL starts with a double slash
问题描述
在过去几个月我看到的几个页面上,地址的语法如下
On several pages I saw in the last months following syntax for a address
<a href="//mynextpage.html">...</a>
这种网址方式有什么用?它是您调用此站点的协议的通配符吗?
What does this way of an url stay for? Is it a kind of wildcard for the protocol you have called this site?
推荐答案
这意味着,链接引用使用与当前页面相同的协议(http: 或 https:).如果你用 http 调用页面:链接也会转到 http:,如果你用 https 调用页面:链接也有 https.
It means, that the link reference uses the same protocol (http: or https:) like the current page. If you call the page with http: the link goes to http: as well, if you call the page with https: the link has https too.
这不仅对链接最有用,而且对图像、javascript 和其他外部资源最有用.它可以防止在大多数浏览器中引发警告的混合(加密/未加密)内容问题.
This is most useful not only for links but for images, javascript and other external resources. It prevents problems with mixed (encrypted/unencrypted) content which provokes warnings in most browsers.
这篇关于URL 以双斜线开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!