导航跳转,禁止后退

  
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);

当history实体被改变时,popstate事件将会发生; onhashchange()可监听URL的hash部分。

猜你喜欢

转载自www.cnblogs.com/caoxiaokang/p/10405674.html