这种方式,可以消除 后退的所有动作。包括 键盘、鼠标手势等产生的后退动作
history.pushState(null, null, document.URL);
???????window.addEventListener(‘popstate‘, function () {
???????????history.pushState(null, null, document.URL);
???????});
js防止浏览器后退(键盘、鼠标手势)
这种方式,可以消除 后退的所有动作。包括 键盘、鼠标手势等产生的后退动作
history.pushState(null, null, document.URL);
???????window.addEventListener(‘popstate‘, function () {
???????????history.pushState(null, null, document.URL);
???????});
js防止浏览器后退(键盘、鼠标手势)