代码-1
<html>
<head>
<title>Relative Link</title>
</head>
<body>
<p>
child folder <a href="Music/17_2.html">17_2</a>
</p>
</body>
</html>输出
child folder 17_2码-2
<html>
<head>
<title>Relative Link</title>
</head>
<body>
<p>
child folder <a href="/Music/17_2.html">17_2</a>
</p>
</body>
</html>输出
ERR_FILE_NOT_FOUND在输入属性/值的路径开始时,额外的正斜杠href的意义是什么?
发布于 2021-07-20 10:16:44
在解析相对URL时,首先确定基本URL。
对于HTML文档中的链接,即HTML文档的URL (除非被<base>元素覆盖)。
http://example.com/foo/bar包含您的链接。
相对路径
如果URL是相对路径(即不是以/开头的路径):
/中的最后一次之后的所有内容。http://example.com/foo/bar + baz = http://example.com/foo/baz
绝对路径
如果URL是绝对路径(即以单个/开头),那么:
http://example.com/foo/bar + /baz = http://example.com/baz
不要混淆绝对路径和绝对url (后者以方案(如https://)开头)。
在URL规范的第3节中有一个有用的URL部分的图表
https://stackoverflow.com/questions/68453138
复制相似问题