检测Firebug的Javascript? [英] Javascript that detects Firebug?

查看:110
本文介绍了检测Firebug的Javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检测用户是否已启用Firebug的确定方法是什么?

What's a surefire way of detecting whether a user has Firebug enabled?

推荐答案

原始答案:



检查控制台对象(仅使用Firebug创建),如下所示:

Original answer:

Check for the console object (created only with Firebug), like such:

if (window.console && window.console.firebug) {
  //Firebug is enabled
}






更新(2012年1月):



Firebug开发人员已决定删除窗口。 console.firebug 。您仍然可以通过鸭子打字来检测Firebug的存在,例如


Update (January 2012):

The Firebug developers have decided to remove window.console.firebug. You can still detect the presence of Firebug by duck typing like

if (window.console && (window.console.firebug || window.console.exception)) {
  //Firebug is enabled
}

各种其他方法,如

if (document.getUserData('firebug-Token')) ...
if (console.log.toString().indexOf('apply') != -1) ...
if (typeof console.assert(1) == 'string') ...

但一般来说,实际上不应该这样做。

but in general, there should be no need to actually do so.

这篇关于检测Firebug的Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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