Sniff and Disable Firebug Howto (Gmail example)

Here is a simple test to see if users have Firebug installed on their browsers. Obviously this would also weed out non-FireFox users.

if (window.console && window.console.firebug) {
  alert("found Firebug");
}else{
  alert("can't find Firebug");
}


Demo: Sniff for FireBug

You may have noticed this message in your Gmail homepage recently:
Gmail Doesn’t Like Firebug

The reason for that is Firebug by default logs all XMLHttpRequests made for all the websites you visit. The problem is that the data that is logged never gets disposed of or cleared out. Therefore, FireFox having to collect and store that information and the memory for Firefox will eventually get large enough that will cause your computer to start using paged cache. This will then make Gmail seem like you are swimming through molasses. Gmail by default seems to make 22 XMLHttpRequests when I load the main page. It then makes a new XMLHttpRequest every 30 seconds, to check for new emails, so in the span of 1 hour you will have 120 new Ajax calls tacked on. This is a nice feature of Gmail which makes life simple for its users (Notice there is no “Get new mail” button anywhere). But now every new Ajax call is another 1kb of data which adds to the memory usage and tacks on more CPU and RAM consumed by Firebug.

No need to worry though since, another nice feature of Firebug is that you can disable it on a domain name basis.

How to disable Firebug for any domain name ex) mail.google.com To turn off Firebug for mail.google.com first open Firebug by hitting the green icon or F12. Click on the bug icon in the top left and choose the second option labeled “Disable Firebug for mail.google.com”. Now Firebug will be turned off and the green icon will be changed to a silver icon for this domain. You should notice a smoother and faster Gmail experience. You can also turn it back on by clicking on the link “Enable Firebug for this website”.

Allowed Sites… The other and better method of speeding up your Firefox and still keeping Firebug around, is to disable Firebug all together and enable it for specific sites that you are working on. To disable Firebug, again you click on the Bug icon and this time choose the first option “Disable Firebug”.
Now visit any site that you would like to use Firebug on and then “right click” on the silver icon on the bottom and choose “Allowed Sites…” From here you can add the domain name for any sites you want to override. This makes your life easier and makes general surfing faster in FireFox, yet allows for using the powers of the almighty Firebug when needed.

If your application is similar to Gmail where XMLHttpRequests are called in a loop you may want to use the sniff script to warn users to disable Firebug for your domain as well.

Visited 13513 times, 7 so far today

4 Comments on “Sniff and Disable Firebug Howto (Gmail example)”

  1. Would this work with greasemonkey? is there a different name after “console” for each plugin?

  2. JAVASCRIPT update from Ajaxian

    // code yanked from the Yahoo media player. Thanks, Yahoo.
    if (! ("console" in window) || !("firebug" in console)) {
        var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group"
                     , "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
        window.console = {};
        for (var i = 0; i <names.length; ++i) window.console[names[i]] = function() {};
    }
  3. I use Firefox 3.0.11 and firebug 1.3.3. By me do’nt exist menu disable site for firebug. :(

  4. This post hasn’t been updated for the newer versions of Firebug.
    The 1.4 series brought a new model of activation, which you can read about here: http://www.softwareishard.com/blog/firebug/how-to-enable-and-disable-firebug-14/

    Bottom line: open the Firebug panel and click the “Off” button on the top right to de-activate Firebug for the current tab and domain.

Leave a Reply