【html】css、js实现网页内容禁止选中

原文链接: http://www.cnblogs.com/richerdyoung/p/11586027.html

网页内容不能选中、复制应该如何实现呢?

通过css

*{
moz-user-select: -moz-none;
-moz-user-select: none;
-o-user-select:none;
-khtml-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
user-select:none;
}

通过body标签


//前面一句是禁止右键,后面一句是禁止复制。

通过js

//禁止页面选择以及鼠标右键
document.οncοntextmenu=function(){return false;}; 
document.onselectstart=function(){return false;};

  

 

转载于:https://www.cnblogs.com/richerdyoung/p/11586027.html

你可能感兴趣的:(【html】css、js实现网页内容禁止选中)