js禁止浏览器回退

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

 

posted @ 2018-11-22 20:42  民院小青年  阅读(583)  评论(0)    收藏  举报