Return to Snippet

Revision: 23816
at February 14, 2010 10:46 by johnloy


Initial Code
// Prevent error messages in the cases where a console object doesn't exist
if (!window.console || !console.firebug){
    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() {};
	}
}

Initial URL


Initial Description


Initial Title
Prevent error messages in the cases where a console object doesn't exist

Initial Tags
javascript

Initial Language
JavaScript