我在页面上有一个相对 URL,它被解释为相对于根(而不是相对于当前文档)。想不通为什么。
在页面上:
http://vm:8080/docs
有一个标签:
<a rel="nofollow" href="_sources/index.txt">Show Source</a>
浏览器将此解析为:
http://vm:8080/_sources/index.txt
代替:
http://vm:8080/docs/_sources/index.txt
这是来自 DOM 的锚点的一些信息。
origin http://vm:8080
baseURI http://vm:8080/docs
pathname /_sources/index.txt
href http://sanjay-vm:8080/_sources/index.txt
为什么浏览器在路径名中添加前导斜杠?