[英]What's the difference between // and http or https
I could only find answers about http and https comparison but I would like to ask: Is there any difference if I will use in code //
rather than https://
? 我只能找到有关http和https比较的答案,但我想问一下:如果我在代码中//
而不是https://
使用代码,有什么区别吗? (In addition to reducing the code) (除了减少代码)
For example: 例如:
<a href="//website.com">test></a>
And: 和:
<a href="https://website.com">test></a>
In a URL, //
means "current protocol"; 在URL中, //
表示“当前协议”; either http or https depending on which you're currently using. http或https,具体取决于您当前使用的是哪个。
Just to be crystal clear, the difference between using //
rather than https://
is that the second specifies the protocol (https), whereas the first uses the current protocol (which could be http
or https
, like wizzwizz4 answered). 为了明确起见,使用//
而不是https://
的区别在于,第二个指定了协议(https),而第一个使用了当前协议(可以是http
或https
,如wizzwizz4回答)。 See this question for more details 查看此问题以获取更多详细信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.