Detect firebug opening and closing

Does anybody have a way to detect Firebug opening and closing.

I know you can do the following:

  • browser cache bypassed in firefox?
  • How to enable embedded javascript debugger in SWT browser?
  • “element.dispatchEvent is not a function” js error caught in firebug of FF3.0
  • How can I see included JavaScript sources?
  • Is console.dir() in javascript or firefox asynchronous?
  • What is the 'iterator' function in Firebug?
  • if (window.console && window.console.firebug) {
      //Firebug is enabled

    but this only detects the firebug console on page load. What I want to do is on a page where firebug is not open, detect the opening of the firebug console.

    I’ve tried the following, but with no luck

      if(window.console && window.console.firebug){
    }, 1000);

    Any help greatly appreciated.


  • Firebug not displaying all object properties
  • Http headers in Javascript?
  • Setting breakpoints dynamically at runtime in Javascript
  • Drupal Commons site has no style after install - missin js and css files at all
  • Javascript that detects Firebug?
  • Java- How to get the HTML code from a URL including its AJAX generated code using Firebug or any Java library
  • 6 Solutions collect form web for “Detect firebug opening and closing”

    Simply.. You cant. The firebug window not just an another couple of div element on your page.

    The Firebug window.console object is created just before the first Javascript in the page is executed but only if Firebug is active for the page before the first JS and if the user has the Firebug Console panel enabled.

    In other words, from within the page you can only detect if the Console is enabled. But for your purposes that should be enough.

    We should delete the console property if a user turns Firebug off for a page. I don’t know if we actually do that.

    Firebug overwrites the console property of window, so you may detect it like so:

    var _console = window.console;
    Object.defineProperty(window, 'console', {
        set: function (x) {
            if (x.exception) { // check if this is actually Firebug, and not the built-in console
                alert('Firebug on');
            _console = x;
        get: function () {
            return _console;

    The problem is that this object remains when Firebug is closed, so you can’t detect that. Maybe there’s some other way but I can’t find it ATM.

    It’s not possible to access Firebug’s execution context from document scripts, so we’re limited to waiting for Firebug to access some of window‘s properties, which does not seem to happen when you close Firebug. Here’s some of the events during shutdown, taken with FBTrace:

    Firebug stack trace

    I’ve searched the stacktrace for “leaks” to window, but couldn’t find any.

    console.table() returns “_firebugIgnore” if firebug is running.

    if( window.console && (console.firebug || 
       console.table && /firebug/i.test(console.table()) ))
        alert('Firebug is running');
        alert('Firebug is not found');

    you can make it as

    var t = setTimeout("CheckFireBug()",10000);
    function CheckFireBug() {
        var t = setTimeout("CheckFireBug()",10000);
        if (window.console && window.console.firebug) {
            //Firebug is enabled
            console.debug('Firebug is enabled.');
        } else {
            //Firebug is not enabled
            console.debug('Firebug is not enabled.');

    If you only want to detect Firebug opening/closing you can check window resize/blur events.