disable back button of browsers 禁用浏览器后退键

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/vernice/article/details/72972944
	<script>
		history.pushState(null, document.title, location.href);
		window.addEventListener('popstate', function (event)
		{
			history.pushState(null, document.title, location.href);
		});
		window.location.hash="no-back-button";
		window.location.hash="Again-No-back-button";//again because google chrome don't insert first hash into history
		window.onhashchange=function(){window.location.hash="no-back-button";}
	</script> 	
It works for most popular browsers. 

猜你喜欢

转载自blog.csdn.net/vernice/article/details/72972944