This article will introduce the blocked applications in js. You can select, cut, copy, and screen blocking content on webpages. In short, you can imagine all of them. For more information, see, I hope this will help you learn about js blocking.
The 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;
}
}
/**
* Shield the "back" function (Google)
* @ 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 viewing source files ()
*/
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;