Home > Web Front-end > JS Tutorial > Block the js code copied by right-clicking on the web page and copying with ctrl c_javascript skills

Block the js code copied by right-clicking on the web page and copying with ctrl c_javascript skills

WBOY
Release: 2016-05-16 17:44:42
Original
1159 people have browsed it

There are always some websites that will block your right mouse button or use shortcut keys to copy. In fact, it is just a piece of js code. The solution is to directly save the web page and delete the following js code, and then you can use the right-click menu normally.
Of course, you can also solve the problem by setting the browser's security level to the highest level.

Copy code The code is as follows:

<script> <br>document.oncontextmenu = function (){ <br>return false; <br>} <br>document.onkeydown = function(){ <br>if (event.ctrlKey && window.event.keyCode==67){ <br>return false; <br>} <br>} <br>document.body.oncopy = function (){ <br>return false; <br>} <br>document.onselectstart = function(){ <br>//return false; <br>} <br></script>
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