Jquery禁止浏览器的前进后退
发布时间:2022-12-06 00:00:04 280 相关标签:
jQuery(document).ready(function () {
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);
});
文章来源: https://blog.51cto.com/u_15897407/5899659
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报