Monday, May 20, 2024
130
rated 0 times [  135] [ 5]  / answers: 1 / hits: 126791  / 9 Years ago, tue, february 24, 2015, 12:00:00

Is it possible to remove or disable Inspect Element context menu in Chrome App via Javascript?



I have searched through several forums but there are no definite answer.


More From » google-chrome

 Answers
12

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).


[#67698] Saturday, February 21, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sandra

Total Points: 708
Total Questions: 100
Total Answers: 84

Location: Bosnia and Herzegovina
Member since Thu, Jun 24, 2021
3 Years ago
sandra questions
Tue, Jun 30, 20, 00:00, 4 Years ago
Sun, May 31, 20, 00:00, 4 Years ago
Wed, May 20, 20, 00:00, 4 Years ago
Fri, May 31, 19, 00:00, 5 Years ago
;