JS禁止网页被复制以及禁止鼠标右击代码
<script type="text/javascript">
//禁止鼠标右键
document.oncontextmenu = function(){
return false;
}
//禁止元素被选中
if (typeof(document.onselectstart) != 'undefined') {
// IE chrome下禁止元素被选中
document.onselectstart = function(){
return false;
}
} else {
// firefox下禁止元素被选中的变通办法
document.write('<style type="text/css">body { -moz-user-select: none; }</style>');
}
</script>
本文来自博客园,作者:随缘的一个人,转载请注明原文链接:https://www.cnblogs.com/dawnwing/articles/18517548

浙公网安备 33010602011771号