输入banner图图片脚本导航/分类

JS如何实现禁止浏览器回退

本文主要和大家分享JS如何实现禁止浏览器回退,主要以代码形式,希望能帮助到大家。

//禁止浏览器的回退
$(function() {
if (window.history && window.history.pushState) {
$(window).on('popstate', function () {
window.history.pushState('forward', null, '#');
window.history.forward(1);
});
}
window.history.pushState('forward', null, '#'); //在IE中必须得有这两行
window.history.forward(1);
});

相关推荐:

以上就是JS如何实现禁止浏览器回退的详细内容,更多请关注Gxl网其它相关文章!