代码描述:JavaScript禁止 复制网页内容。JavaScript禁止复制网页内容代码下载
现在很多客户要求不能够复制网页的内容,具体来说就是禁止鼠标右键和禁用选中功能,下面就介绍一下利用javascript实现此功能,不过这种方法只能够防住不懂网络知识的人,如果稍有网络知识就能够轻松破解。 代码实例如下:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="https://www.51qianduan.com/" /> <title>51前端</title> <style type="text/css"> #thediv{ width:250px; height:30px; line-height:30px; text-align:center; margin:0px auto; } </style> <script type="text/javascript"> document.oncontextmenu=function(){return false} document.onselectstart=function(){return false} </script> </head> <body> <div id="thediv">右键和选中效果已经被禁用</div> </body> </html>
请绑定手机号,在继续操作
注意:只有绑定手机以后,才可使用网站全部功能