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



Sample code for JavaScript prohibiting page operations_javascript tips
javascript
prohibit
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:
< SCRIPT language=JavaScript1.2>
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
--------------- ----------------------------------------
--------------------------------- -------------------------- < script language="JavaScript">
< style>
body{
-moz-user-select:none;
hutia:expression(this.onselectstart=function(){return(false)});}
< /style>
Here is the content of the web page. Can you copy it?