code directly
document.onkeydown = function(){ if(window.event && window.event.keyCode == 123) { alert( "F12 is disabled" ); event.keyCode=0; event.returnValue=false; } if(window.event && window.event.keyCode == 13) { window.event.keyCode = 505; } if(window.event && window.event.keyCode == 8) { alert(str +"\nPlease use the Del key to delete characters!" ); window.event.returnValue=false; } } // Add a custom event for the right button, you can disable window.oncontextmenu = function () { event .preventDefault(); // prevent default event behavior return false ; } // disable pre-debugging and console developer tools var threshold = 160; // width or height threshold to open console // Check every second window.setInterval( function () { if (window.outerWidth - window.innerWidth > threshold || window .outerHeight - window.innerHeight > threshold) { // window.close();//Close the page CloseWebPage(); } }, 1e3); function CloseWebPage() { if (navigator.userAgent.indexOf("MSIE") > 0) { if (navigator.userAgent.indexOf("MSIE 6.0") > 0) { window.opener = null; window.location.href="about:blank"; window.close(); } else { window.open('', '_top'); window.location.href="about:blank"; window.top.close(); } } else if (navigator.userAgent.indexOf("Firefox") > 0) { window .location.href = 'about:blank '; // The default state of Firefox is non-window.open page window.close is invalid //window.history.go(-2); } else { window.opener = null; window.open('', '_self', ''); window.location.href="about:blank"; window.close(); } }