Absolute (full) URLs without “http:” in HTML href

前端 未结 1 1037
执笔经年
执笔经年 2021-01-07 22:18

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?

相关标签:
1条回答
  • 2021-01-07 23:06

    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.)

    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).

    0 讨论(0)
提交回复
热议问题