HTML href 路径奇怪的行为
HTML href path weird behavior
我在这个网站上观察到一个奇怪的行为:http://www.tribunalconstitucional.pt/tc/acordaos/
有一个打印页面的按钮 href
:
<a href="/tc/acordaos/?impressao=1"> ... </a>
不是应该像这样构建 link,重复 /tc/acordaos/
部分吗?
http://www.tribunalconstitucional.pt/tc/acordaos/tc/acordaos/?impressao=1
为什么浏览器构建 link "correctly" 如下?我在这里遗漏了什么吗?
http://www.tribunalconstitucional.pt/tc/acordaos/?impressao=1
href
中的前缀/
表示根(主机名)。
example.com/doo
这样的事情:
href="/foo/bar"
会转到 example.com/foo/bar
。
如果没有添加前缀 /
,它将转到 example.com/doo/foo/bar
我在这个网站上观察到一个奇怪的行为:http://www.tribunalconstitucional.pt/tc/acordaos/
有一个打印页面的按钮 href
:
<a href="/tc/acordaos/?impressao=1"> ... </a>
不是应该像这样构建 link,重复 /tc/acordaos/
部分吗?
http://www.tribunalconstitucional.pt/tc/acordaos/tc/acordaos/?impressao=1
为什么浏览器构建 link "correctly" 如下?我在这里遗漏了什么吗?
http://www.tribunalconstitucional.pt/tc/acordaos/?impressao=1
href
中的前缀/
表示根(主机名)。
example.com/doo
这样的事情:
href="/foo/bar"
会转到 example.com/foo/bar
。
如果没有添加前缀 /
,它将转到 example.com/doo/foo/bar