首页 > 技术文章 > 利用js实现网页禁止后退

zouchengli 2017-07-20 21:10 原文

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

  

推荐阅读