js禁止浏览器的回退事件

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

posted @ 2019-04-17 21:26  杰520  阅读(1177)  评论(0编辑  收藏  举报