不允许用户复制网页
body
{
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
-ms-user-select: none; /*IE10*/
-khtml-user-select: none; /*早期浏览器*/
user-select: none;
}
兼容低版本的IE6-IE9还没有相关的CSS属性,我们必须用到第二种方式来解决。
document.body.onselectstart = document.body.ondrag = function(){
return false;
}
原作者:https://www.jianshu.com/p/ca78db48edec