Home >Web Front-end >JS Tutorial >Sample code for JavaScript prohibiting page operations_javascript tips

Sample code for JavaScript prohibiting page operations_javascript tips

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 17:08:441179browse

Simple JS prohibits page right-click menu - to avoid website information being stolen

Copy code The code is as follows:



Web page The prohibition of copying is mainly implemented through JavaScript.

ondragstart="return false" onbeforecopy="return false" oncopy=document.selection.empty() onselect=document.selection.empty( )>
-------------------------------------------------- ---
JS to prevent copying
---------------------------------------- ----------
Copy code The code is as follows:


function disableselect(e){
return false}
function reEnable(){return true
}
file://if IE4
document. onselectstart=new Function ("return false")
file://if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}



--------------------------------- --------------------------
Prevent downloading js
--------------- ----------------------------------------

--------------------------------- --------------------------





CSS prohibits selection and copying


body{
-moz-user-select:none;
hutia:expression(this.onselectstart=function(){return(false)});}




Here is the content of the web page. Can you copy it?

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