1. 方法一: 超好用, 收藏
<script language="javascript">
//防止页面后退, 目前仅适用于chrome,Firefox,360极速模式
history.pushState(null, null, document.URL);
if (window.addEventListener) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
history.pushState(null, null, document.URL);
scrollTo(0,0);
});
} else if (window.attachEvent) {
window.attachEvent('onpopstate', function () {
history.pushState(null, null, document.URL);
scrollTo(0,0);
});
}
</script>
2. 方法二: url没有变但是页面还会刷新
<script language="JavaScript"> javascript:window.history.forward(1); </script>