JQuery 阻止浏览器后退按钮

方案一(个人试过360,谷歌,QQ浏览器都可以,方案二有的浏览器还是可以后退,避免万无一失最好使用方案一)

    <script type="text/javascript">
        function ban() {
            if (window.history && window.history.pushState) {
                $(window).on('popstate', function () {
                    window.history.pushState('forward', null, '#');
                    window.history.forward(1);
                });
            }
            window.history.pushState('forward', null, '#'); //在IE中必须得有这两行
            window.history.forward(1);
        }
    </script>

方案二

   <script  language="javascript">   
   <!--   
    javascript:window.history.forward(1);   
  //-->   
   </script>