如何重新启用右键点击,以便我可以检查Chrome中的HTML元素? [英] How to re-enable right click so that I can inspect HTML elements in Chrome?

查看:213
本文介绍了如何重新启用右键点击,以便我可以检查Chrome中的HTML元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看覆盖右键单击按钮的网页,以显示其自己的弹出式HTML元素。



这可以防止我使用Chrome开发人员工具检查元素。

有人知道我可以使用JavaScript代码段从Chrome控制台注入
重新启用右键单击功能?



我可以打破现有的右键单击功能,能够很容易地检查HTML元素。



谢谢。

解决方案

如果他们刚刚更改了 oncontextmenu 处理程序(这是最直接的方式),那么您可以删除它们的覆盖:

  window.oncontextmenu = null; 

否则,如果它附加到单个元素上,则可以获取所有页面的元素,然后删除每一个处理器:

  var elements = document.getElementsByTagName(*); 
for(var id = 0; id< elements.length; ++ id){elements [id] .oncontextmenu = null; }

或者,您似乎可以关闭此类脚本; 通过Chrome中的扩展程序在Firefox中选择 - 在JavaScript选项的高级框中,关闭禁用或替换上下文菜单。

I am looking at a web page which has overwritten the right-click button so to display its own popup HTML element.

This prevents me from using Chrome Developer Tools to inspect elements.

Does anybody know a JavaScript snippet I could inject from the Chrome Console to re-enable the right-click?

I am okay to break the existing 'right-click' functionality, so to be able to inspect the HTML elements easily.

Thanks.

解决方案

If they have just changed the oncontextmenu handler (which is the most straightforward way to do it), then you can remove their override thus:

window.oncontextmenu = null;

Otherwise, if it is attached to individual elements, you can get all the page's elements, and then remove the handler on each one:

var elements = document.getElementsByTagName("*");
for(var id = 0; id < elements.length; ++id) { elements[id].oncontextmenu = null; }

Or, it seems you can turn off such scripts; via an extension in Chrome or an option in Firefox - in the advanced box for javascript options, switch off 'Disable or replace context menus'.

这篇关于如何重新启用右键点击,以便我可以检查Chrome中的HTML元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆