浏览器后退事件

来源:互联网 发布:淘宝卖家联系客服电话 编辑:程序博客网 时间:2024/05/19 23:28
<script type="text/javascript">$(document).ready(function(e) {             var counter = 0;if (localStorage.lastname != "test") {localStorage.lastname="test";            if (window.history && window.history.pushState) {                             $(window).on('popstate', function () {                                            //window.history.pushState('forward', null, '2.html');                                            //window.history.forward();$('#myModal').modal('show');return;                                         //window.location.href="http://py028.w9py.com/2.html";                                });              }            }              window.history.pushState('forward', null, '#'); //在IE中必须得有这两行              window.history.forward(1);});</script>