Network-Path Reference URI / Scheme relative URLs

无人久伴 提交于 2019-11-26 15:09:05
Daniel Vassallo

//domain.com/img.png is a perfectly valid URI syntax as per RFC 3986: Section 4.2.

It is relative to the current scheme, and therefore as you mentioned, it can be very useful when switching between http and https, because you won't need to explicitly specify the scheme.

All modern browsers will understand that format, including IE 6.

Further reading on Stack Overflow:

MPV

If you want to support IE 7 and 8, you might want to consider that scheme relative URLs for stylesheets will cause them to be downloaded twice:

[...] if you try this in Internet Explorer 7 and 8 you’ll see that stylesheets specified with a protocol relative URL are downloaded twice.

Developers should avoid using protocol relative URLs for stylesheets if they want their pages to be as fast as possible in Internet Explorer 7 & 8.

Source: http://www.stevesouders.com/blog/2010/02/10/5a-missing-schema-double-download/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!