Home > Web Front-end > JS Tutorial > Javascript prohibits visitors from copying web page content implementation code_javascript skills

Javascript prohibits visitors from copying web page content implementation code_javascript skills

WBOY
Release: 2016-05-16 15:47:14
Original
1150 people have browsed it

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>

Copy after login

I hope this article will be helpful to everyone’s JavaScript programming design.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template