Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在页面加载后删除以前的历史状态。
这是与我的另一个问题不同的问题;不仅仅是一种选择。
如果您通过 JS 加载新页面,您可以replace在其位置使用相同的历史记录条目:
replace
window.location.replace(url);
看到这个答案。
另一种方法是使用history.replaceState.
history.replaceState