Wednesday , 25 November 2020
Stackode
Home > Javascript / Jquery > How To Disable or Block Inspect Element in Browser/Website

How To Disable or Block Inspect Element in Browser/Website

In that page I want to block the user to perform below actions,

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

The below link,

http://andrewstutorials.blogspot.in/2014/03/disable-ways-to-open-inspect-element-in.html

Disabled Right Click :

add on your tag body html

<body oncontextmenu="return false;">

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

Resource Link : https://stackoverflow.com/questions/28690564/is-it-possible-to-remove-inspect-element

About Whendy

Whendy Blog mengumpulkan beberapa Tutorial Website, PHP, AngularJS, JQuery, Laravel, Codeigniter dan lain-lain. ( jika sempat ) :)

Leave a Reply

Your email address will not be published. Required fields are marked *