Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 15:35:32
Original
1787 people have browsed it

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.

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