DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Gracefully Ignore Firebug Script Errors When Firebug Not Present

  • submit to reddit
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 = {};
 var EmptyFn = function() {};
 for (var i = 0; i <names.length; ++i) window.console[names[i]] = EmptyFn;