js禁止浏览器的回退事件

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

原文地址:https://www.cnblogs.com/jhuang-com/p/10726310.html