1. 程式人生 > >網頁防止後退,禁止點選左上角的

網頁防止後退,禁止點選左上角的

網頁防止後退,禁止點選左上角的<

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

注:程式寫完後找bug,一定注意瀏覽器網址,容易出現Bug