我一直在阅读关于URL的内容,包括绝对URL、方案相关URL、根相关URL和位置相关URL。
但我仍然不明白这两者之间的区别:
//domain.com/index.html - scheme relative
domain.com/index.html - ?
问题 1:
如果我没错,//domain.com/index.html
将解析为绝对 URL,如下所示:
http://domain.com/index.html
https://domain.com/index.html
ftp://domain.com/index.html
file://domain.com/index.html -- if in email
浏览器会有不同的反应:ie6不支持,ie7,8将获取数据两次(http https)。
.
问题2:
domain.com/index.html
会如何解析?与Q1中的scheme相对url相同吗?还是其他什么?
.
问题3:
这些url之间有什么区别,是什么以及为什么?
//www.domain.com/index.html
www.domain.com/index.html
问题4:
//www.domain.com/index.html
将如何解析?
.
问题5:
www.domain.com/index.html
将如何解析?
http://www.domain.com/index.html
和 Q5:(location relative)http://example.com/www.domain.com/index.html
,提供的基本URL为http:example.com
,对吗? - CoRmailto:foo@example.com
、data:text/plain,test
和urn:example
永远不会被解析为相对URI。然而,如果有一个前导斜杠,它们仍然会被解析为相对URI。 - IMSoP