Sunday, November 29, 2009

Detecting Firebug with JavaScript

Need to implement some debugging methods for your library with Firebug's console as your Output Window?

Here's a quick way to check if Firebug is enabled:

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

Obviously, this is not a fool-proof method because anyone can overwrite the console object, but I think that it's the best you're gonna get.