监听浏览器的返回事件,禁止浏览器返回

https://www.cnblogs.com/Easty/p/7820055.html

//禁止页面后退   
history.pushState(null,null,document.URL);
window.addEventListener('popstate',function(){
	//监听浏览器的返回事件
	history.pushState(null,null,document.URL); 
});

猜你喜欢

转载自blog.csdn.net/Lyj1010/article/details/84564938