Is it possible to remove "Inspect Element"? Is it possible to remove "Inspect Element"? google-chrome google-chrome

Is it possible to remove "Inspect Element"?


I have one requirement for one page. 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

For this I googled, finally got the below link,

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

I tested with it with Chrome & Firefox. It's working for my requirement.

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


It is possible to prevent the user from opening the context menu by right clicking like this (javascript):

document.addEventListener('contextmenu', function(e) {  e.preventDefault();});

By listening to the contextmenu event and preventing the default behavior which is "showing the menu", the menu won't be shown.But the user will still be able to inspect code through the console (by pressing F12 in Chrome for example).


You can't.

Everything on a web page is rendered by the browser, and they want web sites to properly work on them or their users would despise them.As a result, browsers want to expose the lower level ticks of everything to the web developers with tools like code inspectors.

You could try to prevent the user from entering the menu with a key event. Something like this:

// Disable inspect element$(document).bind("contextmenu",function(e) {  e.preventDefault();});$(document).keydown(function(e){  if(e.which === 123){    return false;}});

But if a user want to see the code, he will do it in another way. He will just need a little longer.

Short: If you do not want people to get something in their browser, you shouldn't send it to their browser in the first place.