Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
html<;基地>;标签功能被误解了吗?_Html - Fatal编程技术网

html<;基地>;标签功能被误解了吗?

html<;基地>;标签功能被误解了吗?,html,Html,我有简单的IIS结构: 默认网站 特斯塔普 DefaultWebsite-可转到192.168.1.5访问登录页 testapp-可通过访问192.168.1.5/testapp访问web应用程序 testapp的index.html <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Test App</title>

我有简单的IIS结构:

  • 默认网站
    • 特斯塔普
DefaultWebsite-可转到192.168.1.5访问登录页

testapp-可通过访问192.168.1.5/testapp访问web应用程序

testapp的index.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Test App</title>
    <base href="/testapp/" >
</head>
<body>
    <a href="/">Test Link</a>
</body>
</html>

测试应用程序
我使用base标记来设置应用程序的base,所以当单击Test链接时,我希望只重新加载页面,因为它指向的是根文档。 但事实并非如此。点击“测试链接”将我带到DefaultWebSite的索引


这就是应该如何工作的方式,还是我没有正确理解base标记…

base只在相对的HREF上起作用。所以

<a href="/">Test</a>

根本不受基础的影响


BalusC在

上有一个关于其用法的非常详细的答案,
base
标记只适用于所有相对URL。因此,对于像
这样的基本标记,以下内容将适用

<a href="/index.html">link</a>

将参考DefaultWeb站点

但是


请参考您的testapp

<a href="index.html">link</a>