Javascript that detects Firebug?

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.

Leave a Comment