本文主要和大家分享js關于監聽瀏覽器后退事件詳解,希望本文的代碼能幫助到大家。
直接上代碼(可直接使用)
<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="orderinfo.html"; //如查需要跳轉頁面就用它 }); } window.history.pushState('forward', null, '#'); //在IE中必須得有這兩行 window.history.forward(1); }); </script>
相關推薦:
js監聽瀏覽器tab頁切換的實例
js里如何監聽瀏覽器關閉的動作 在線等_html/css_WEB-ITnose
有道Javascript監聽瀏覽器的問題_javascript技巧
以上就是js關于監聽瀏覽器后退事件詳解的詳細內容,更多請關注php中文網其它相關文章!