Answers for "how to prevent user from inspect element"

0

disable inspector

/* It's possible, but this would block the following commands:
 * Right Click (entirely!)
 * F12
 * Ctrl + Shift + I
 * Ctrl + Shift + J
 * Ctrl + Shift + C
 * Ctrl + U
*/

// Right click
<body oncontextmenu="return false">

// Keys
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 == 'C'.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;
  }
}
Posted by: Guest on January-04-2021
0

how to prevent user from inspect element

document.addEventListener('contextmenu', function(e) {
  e.preventDefault();
});
Posted by: Guest on May-10-2021

Code answers related to "how to prevent user from inspect element"

Browse Popular Code Answers by Language