javascript怎么禁用浏览器后退按钮

javascript禁用浏览器后退按钮的方法:

<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.οnhashchange=function(){window.location.hash="no-back-button";}
</script>
正在加载评论...