【发布时间】:2017-11-01 14:50:53
【问题描述】:
我将/is/ 设置为基本href,并在使用replaceState() 的index.html 中使用以下简单代码:
<base href="/is/">
<script>
setTimeout(()=>{
history.replaceState(null, "", "#/some");
}, 2000);
</script>
代码执行前的URL如下所示:
http://localhost:8080/index.html
然而,一旦代码被执行,index.html 就消失了,URL 看起来像这样:
http://localhost:8080/is/#/some
我希望它看起来像这样:
http://localhost:8080/is/index.html#/some
为什么index.html 不见了?
【问题讨论】:
标签: javascript html browser-history pushstate