JS 禁止刷新和右键

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
 
<body>
 <div style="width:100px; height:100px; background:#09C;"
</body>
<script type="text/javascript">
//F5
document.documentElement.onkeydown=function(e){
    e=e||window.event;
    if(e.keyCode==116){
        if(e.returnValue){
            e.returnValue=false;
        }else{
            e.stopPropagation();
        }
        return false;
    }
}
//右键
document.documentElement.oncontextmenu=function(e){
    e=e||window.event;
    e.cancelBubble = true;
    e.returnValue=false;
    return false;
}
</script>
</html>

 没有测试

JS 禁止刷新和右键,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。