shorthand http:// as // for script and link tags? anyone see / use this before?

前端 未结 2 1557
走了就别回头了
走了就别回头了 2020-11-27 22:10

the question is as follows:

if you take a look at any site using addthis (the share button)...

once you float over the addthis button, and all of the require

2条回答
  •  醉话见心
    2020-11-27 22:19

    Starting a URL with // means "Use a different server but keep the same scheme"

    So if you load //example.net/script from https://example.com/ it will get https://example.net/script, while if you load it from http://example.com/ it will get http://example.net/script.

    If, on the other hand, you load it from file://c:/Users/You/Documents/test.html then it will probably not resolve to anything useful. Make sure you do development with a local web server (and access http://localhost/) if you use this syntax.

    This is a standard part of URIs, it well supported, and is usually known as "scheme relative URIs"

提交回复
热议问题