Monday, November 20, 2017
Home » Domains & Hosting » Disable ways to open Inspect Element in JavaScript and HTML

Disable ways to open Inspect Element in JavaScript and HTML

Introduction
I wrote a script that disables practically all the ways to access Inspect Element in JavaScript. Here’s what it blocks:

Right Click
F12
Ctrl + Shift + I
Ctrl + Shift + J
Ctrl + U

What you need

Basic JavaScript knowledge
HTML editor

What you do
Right Click
Copy the HTML below!

<body oncontextmenu="return false;">

Keys
Copy the JavaScript below!

document.onkeydown = function(e) {
if(event.keyCode == 123) {
return false;
}
if(e.ctrlKey && e.shiftKey && e.keyCode == ‘I’.charCodeAt(0)){
return false;
}
if(e.ctrlKey && e.shiftKey && e.keyCode == ‘J’.charCodeAt(0)){
return false;
}
if(e.ctrlKey && e.keyCode == ‘U’.charCodeAt(0)){
return false;
}
}