js在html禁止右键的方法

在html页面引入js

<script type="text/javascript" src="${contextPath}js/common/preventCopy.js"></script>

document.oncontextmenu = function(){
return false;
}
document.onkeydown = function(){
if (event.ctrlKey && window.event.keyCode==67){
return false;
}
}
document.body.oncopy = function (){
return false;
}
document.onselectstart = function(){
//return false;
}

 

你可能感兴趣的:(html)