Web开发中http://和//之间有什么区别? [英] What is the difference between http:// and // in web development?
问题描述
可能重复:
我可以将所有链接更改为//?
我最近遇到了这个问题,同时探索了谷歌404页面的标记。在其中,他们使用//在他们的URL的开头,在标记中的锚点,以及在他们的CSS中引用图像/等。
I came across this recently whilst poking around the markup for Google's 404 page. In it, they use // at the start of their URLs, in anchors in the markup, as well as referencing images/etc in their CSS.
因为它不是什么东西我之前遇到过,并且考虑到谷歌在有限细节优化方面臭名昭着,我想我会在这里询问是否有人有关于使用//的更多信息而不是http://这不是可以很容易地用Google搜索来找到答案。
Since it's not something I've come across before, and given that Google is notorious at finite-detail optimisation, I thought I'd ask here and see if anyone has any more information on the use of // instead of http:// it's not something that can be easily Googled about to find an answer.
我知道//在http或https可能起作用的应用程序中很有用,但是除此之外,还有其他好处吗?是否所有浏览器都支持?有任何使用限制吗?这是新的/旧的吗?
如果有人有任何信息,我会非常感兴趣。
I'd be really interested if anyone has any information.
推荐答案
//
是无论目前的协议是什么。
//
is "Whatever the current protocol is".
在通过http提供的页面上,它是 http://
,而在https上它是 https://
。
On a page served over http, it is http://
, and over https it is https://
.
这篇关于Web开发中http://和//之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!