使用history.replaceState后,仍然会留下一推历史记录?
我的main.js里有这句
var updateAnchor = function (anchor) {
if (window.history.replaceState && anchor !== window.location.hash) {
window.history.replaceState(undefined, undefined, anchor)
}
}
test页面: https://jerryc.me/posts/198a4...
可以看到
网页滚动下去
替换了好几个hash
按道理应该只留下一个浏览记录
但是结果是依旧留下很多记录
不知道怎么解决问题