js实现禁止浏览器后退

试了网上不少的js禁止浏览器后退的代码,发现只有下面的一种效果还是可以的。

<script language="javascript">
    history.pushState(null, null, document.URL);
    window.addEventListener('popstate', function () {
        history.pushState(null, null, document.URL);
    });
</script>

 

上一篇:jdk7 HashMap解析


下一篇:Android自定义对话框(Dialog)位置,大小