Home  >  Article  >  Web Front-end  >  JavaScript code easily prohibits copying of web page content (simple code)_javascript skills

JavaScript code easily prohibits copying of web page content (simple code)_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:35:321729browse

The following code is very simple and can easily prohibit copying of web content.

Sometimes we need to prevent others from copying the content of the website. The following code can easily achieve this function!

Block the right mouse button

Copy code The code is as follows:

function document.oncontextmenu(){event.returnValue=false;}

Disable copy selection

Copy code The code is as follows:

function document.onselectstart(){return false;}

This article only shares the key parts of the code with you. The details still need to be supplemented by ourselves according to the needs.

Statement:
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