window.history.pushState(null, null, window.location.href);
window.addEventListener("popstate", function () {
window.history.pushState(null, null, window.location.href);
});
产品同学总是会提出各种稀奇古怪的需求,比如qj用户的返回操作。。。
上面的代码经常被用来禁止网页页面的返回,经过个人的测试(Chrome/92.0.4497.0),必须在用户有了交互之后才能生效,否则不生效;