Graceful Degradation of Firebug Console Object
Date : 2008 01 28 Category : Tech & DevelopmentPaul Irish saw the following graceful degradation of Firebug code in the Yahoo! media player:
PLAIN TEXT JAVASCRIPT:// 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() {}; }
I would love to see a window.console API based on Firebug standardized so it can just be there. But then this code will still be around for pre-browsers.