Firebug

By | 22 Dec 2008

Firebug is a useful Firefox extension to debug JavaScript and more. To not raise error messages on browsers without Firebug, there’s a small script called firebugx.js, which creates empty
functions. Sascha Hameister has optimized this script a little bit and it now looks like this:

// FirebugX for browsers without Firebug
if (!window.console || !console.firebug) {
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "trace",
                 "group", "groupCollapsed", "groupEnd", "time", "timeEnd", "profile", "profileEnd", "count"];

    var emptyFunction = function() {};

    window.console = {};
    for (var i = 0, count = names.length; i < count; ++i) {
        window.console[names[i]] = emptyFunction;
    }
}Code language: JavaScript (javascript)

You might also want to use Firebug Lite.

Leave a Reply

Your email address will not be published. Required fields are marked *

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.