Javascript disabling keyboard function keys invalidates right clicks and other keys

  • 2020-03-26 21:22:04
  • OfStack

<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false" onbeforecopy="return false" onmouseup=document.selection.empty() oncopy=document.selection.empty() onselect=document.selection.empty()></body> 

The red display above can be inserted into the page to achieve right - click invalid
Onselectstart ="return false" to disable selection, ondragstart="return false" to disable drag and drop, oncopy=document.selection. Empty () to disable copying.

Do not save: < Noscript> < Iframe SRC = ". * HTM "> < / iframe> < / noscript> In the head.

Do not paste: < Input type = "text onpaste =" return false ">

Close the input method: < Input style = "ime - mode: disabled" >

Block the right mouse button:
The function document. Oncontextmenu () {event. ReturnValue = false; }

Block F1 help:
The function window. Onhelp () {return false}

Shield other keys
function document.onkeydown() 
if ((window.event.altKey)&& 
((window.event.keyCode==37)|| //Shield Alt+ direction key  please 
(window.event.keyCode==39))) //Block Alt+ direction key  - 
alert(" You are not allowed to use ALT+ Direction key forward or back page! "); 
if ((event.keyCode==8) || //Mask the backspace delete key
(event.keyCode==116)|| //Mask the F5 refresh key
(event.ctrlKey && event.keyCode==82)){ //Ctrl + R 
if (event.keyCode==122){event.keyCode=0;event.returnValue=false;} //Shielding F11
if (event.ctrlKey && event.keyCode==78) event.returnValue=false; //Shielding Ctrl + n
if (event.shiftKey && event.keyCode==121)event.returnValue=false; //Shift + F10
if (window.event.srcElement.tagName == "A" && window.event.shiftKey) 
window.event.returnValue = false; //Block shift and left mouse button to open a new page
if ((window.event.altKey)&&(window.event.keyCode==115)) //Alt + F4
return false; 

Screen printing:
@media print{ 
* {display:none} 

Related articles: