禁止瀏覽器返回登入頁面
阿新 • • 發佈:2018-07-09
輸入 func 需要 pre 但是 back self 彈框 hist
目前很多項目都沒有特意做這個處理,就是瀏覽器返回到登入頁面,然後點擊下一頁箭頭,可以進入,但是如果有這個需求只需要在禁止的那個頁面,輸入如下代碼即可
<script> $(document).ready(function (e) { var counter = 0; if (window.history && window.history.pushState) { $(window).on(‘popstate‘, function () { window.history.pushState(‘forward‘, null, ‘#‘); window.history.forward(1); // alert("不可回退"); //如果需在彈框就有它 self.location="index.html?v="+version; //如查需要跳轉頁面就用它 }); } window.history.pushState(‘forward‘, null, ‘#‘); //在IE中必須得有這兩行window.history.forward(1); }); </script>
附加一個FQ軟件:https://my.ishadowx.net/#
禁止瀏覽器返回登入頁面