是否有可能删除“检查元素”? [英] Is it possible to remove "Inspect Element"?
问题描述
是否可以通过Javascript在Chrome应用程序中删除或禁用Inspect Element上下文菜单?
我已经搜索了几个论坛,但没有明确的答案。
可以通过右键点击(javascript)来阻止用户打开上下文菜单:
$ p $
document.addEventListener('contextmenu',function(e){
e.preventDefault();
});
通过监听 contextmenu
事件并防止默认行为是显示菜单,菜单将不会显示。
但用户仍然可以通过控制台检查代码(例如,在Chrome中按F12)。
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.
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).
这篇关于是否有可能删除“检查元素”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!