当前位置: 代码迷 >> Web前端 >> 禁止浏览器退后
  详细解决方案

禁止浏览器退后

热度:34   发布时间:2012-11-07 09:56:10.0
禁止浏览器后退
清除缓存
<meta http-equiv="Expires" CONTENT="0">          
<meta http-equiv="Cache-Control" CONTENT="no-cache">          
<meta http-equiv="Pragma" CONTENT="no-cache">    
抵消后退
<script type="text/javascript">
javascript:window.history.forward(1);
</script> 

<body onbeforeunload="history.go(0)">

//禁止F5使用刷新
document.onkeydown = function(){          
if(event.keyCode==116){          
event.keyCode = 0;          
event.cancelBubble = true;          
return false;          
}          
}
//禁止右键弹出菜单
document.oncontextmenu = function(){          
return   false;          
}
  相关解决方案