没有“http:”的绝对(完整)网址在HTML href中 [英] Absolute (full) URLs without "http:" in HTML href
问题描述
我最近一直看到这个,我无法找到任何相关信息。
I have been seeing this a lot lately and I am unable to find any information on it.
有没有名字?
哪些浏览器支持此功能?
Is there a name for it?
Which browsers support this?
推荐答案
它与绝对URL相同,只是架构将是用于基础的架构URL。因此,如果您在https页面上说 // mysite.com/images/img.png
,图像将加载 https
并在普通http页面上使用 http
架构(以及不同的默认端口)加载。
It's the same as an absolute URL except that the schema will be the one used for the base URL. Thus, if you say //mysite.com/images/img.png
on an https page, the image will be loaded with https
and on an "ordinary" http page it will be loaded using the http
schema (and, respectively, different default ports.)
这种方法可以避免在安全页面加载不安全内容的情况下浏览器发出安全警告(并且可以使用http和https协议加载页面)。
This approach lets avoid the security warnings from browsers in the case when you have insecure content loaded by secure pages (and the pages can be loaded using both http and https protocols).
这篇关于没有“http:”的绝对(完整)网址在HTML href中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!