The javascript implementation prohibits right clicking and F12 from viewing source code

  • 2020-05-10 17:37:19
  • OfStack

Function is very simple, the code is also very simple, here is not much nonsense, directly on the source code, the need for a partner directly away.


function click(e) {
if (document.all) {
if (event.button==2||event.button==3) { alert(" Welcome to our humble abode. If you need any help, please contact the webmaster! Thank you for your cooperation!! ");
oncontextmenu='return false';
}
}
if (document.layers) {
if (e.which == 3) {
oncontextmenu='return false';
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
document.oncontextmenu = new Function("return false;") document.onkeydown =document.onkeyup = document.onkeypress=function(){
if(window.event.keyCode == 123) {
window.event.returnValue=false;
return(false);
}
}
<--123 - 112 is F1-F12 The number of code -->

This is for others not to see your code, for don't understand people oh, if the old hands are unable to defend!


Related articles: