Javascript that detects Firebug?

Allan picture Allan · Dec 29, 2008 · Viewed 14.6k times · Source

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

Answer

Andreas Grech picture Andreas Grech · Dec 29, 2008

Original answer:

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

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

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
}

or various other approaches like

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.