Preguntas Frecuentes - FAQ

How to disable all the ways to open Inspect tool. Imprimir

  • Disable Inspect Tool, JavaScript Code to disable Inspect Tool
  • 0

Introduction

Practlically, There is no code to disable Inspect tool in HTML. I wrote a script that disables 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 do

Copy the JavaScript below & Paste it to the end of the body tag of your page. (Make sure you have added "jquery.min.js" file in your HTML code above.)


$(document).bind("contextmenu",function(e) {

e.preventDefault();
});

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;
}
}


Done. Now open your page in which this code is implemented and experiment by yourself above given shortcuts. Very Simple..!!


¿Fue útil la respuesta?

« Atrás