在Javascript中,我如何“清除”后面(历史-1)? [英] In Javascript, how do I "clear" the back (history -1)?
问题描述
当用户加载页面时,我立即将窗口重定向到另一个位置。
问题是,当用户点击回来时,
我可以取消上一页的历史记录吗?这样当用户点击背部,它可以追溯到两页呢?
而不是使用窗口.location = url;
以重定向,
请尝试:
window.location.replace(url);
使用替代()当前页面后不会被保存在会议
历史,意味着用户将无法使用返回按钮来
导航到它。
When the user loads the page, I immediately do a window redirect to another location.
The problem is, when the user clicks back, it'll go back to the page which does the redirect.
Can I "cancel" the history of the previous page? So that when the user clicks back, it goes back TWO pages instead?
Instead of using window.location = url;
to redirect,
try:
window.location.replace(url);
after using replace() the current page will not be saved in session history, meaning the user won't be able to use the Back button to navigate to it.
这篇关于在Javascript中,我如何“清除”后面(历史-1)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!