Js Shielding Effect
Copy codeThe Code is as follows:
/** Block F1 help */
Window. onhelp = function () {return false ;}
/**
* Block F5, Ctrl + N, Shift + F10, Alt + F4
* If You Want To shield other keys, find the corresponding keyCode and follow this method.
*/
Document. onkeydown = function (event ){
Event = window. event | event;
If (event. keyCode = 116 | (event. ctrlKey & event. keyCode = 78) | (event. shiftKey & event. keyCode = 121) | (event. altKey & event. keyCode = 115 )){
Event. keyCode = 0;
Event. returnvalue = false;
}
}
/** Right-click the block button */
Document. oncontextmenu = function () {return false ;}
// Or
Document. onmousedown = function (event ){
Event = window. event | event;
If (document. all & event. button = 2 ){
Event. returnvalue = false;
}
}
/**
* Block the "back" function (<a href = "javascript: replaceLocation ('HTTP: // www.google.com ')" mce_href = "javascript: replaceLocation ('HTTP: // www.google.com ') "> Google </a>)
* @ Param url the URL to be redirected
*/
Function replaceLocation (url ){
Document. location. replace (url );
}
/** Block selected webpage content */
Document. onselectstart = function () {return false ;}
/** Block and copy webpage content */
Document. body. oncopy = function () {return false ;}
/** Shield and cut webpage content */
Document. body. oncut = function () {return false ;}
/** Hide and paste content on the webpage */
Document. body. onpaste = function () {return false ;}
/** Shield the clipboard screen (without stopping the clipboard )*/
Window. setInterval ('window. clipboardData ("Text", "") ', 100 );
/**
* Shielding the source file (<body onload = clear ()>)
*/
Function clear (){
Var source = document. body. firstChild. data;
Document. open ();
Document. close ();
Document. body. innerHTML = source;
}
/**
* Blocking js errors
*/
Function KillError ()
{
Return true;
}
Window. onerror = KillError;