The example in this article describes how to prevent visitors from copying web content using JavaScript. Share it with everyone for your reference. The details are as follows:
Use JavaScript to prevent users from copying the content on the webpage and disable the mouse selection function. You can try it. After adding onselectstart="return false", text cannot be selected on the webpage, and viewers cannot copy the content of the webpage. .
In fact, this method does not completely prohibit copying. Users can save the webpage as or change the browser to realize the copying function.
Implementation code:
<html> <head> <title>禁止用户复制网页内容</title> </head> <body onselectstart="return false"> <table width="782" height="532" border="0" align="center" cellpadding="0" cellspacing="0" background="bg.jpg"> <tr> <td width="594" height="165"> </td> <td width="188" height="165"> </td> </tr> <tr> <td height="367" align="left" valign="top" style="text-indent:5px; font-size:12px">脚本之家 <p>学习编程</p> <p>努力成为广大脚本技术爱好者的“家”, </p> <p> 让大家在这里能找到归属感!</p> <p>网站提供大量的asp、php、asp .net、javascript、jquery、vbscript、dos批处理、网页制作、网络编程等特色内容。 </p> </td> <td height="367"> </td> </tr> </table> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming design.