js实现 禁用浏览器后退

1 history.pushState(null, null, document.URL);
2 window.addEventListener('popstate', function () {
3     history.pushState(null, null, document.URL);
4 });

可以禁用包括键盘、鼠标手势等产生的所有后退动作。

posted @ 2023-06-04 11:38  cui-YF  阅读(350)  评论(0编辑  收藏  举报