Skip to content

Instantly share code, notes, and snippets.

@textarcana
Created April 28, 2010 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save textarcana/381576 to your computer and use it in GitHub Desktop.
Save textarcana/381576 to your computer and use it in GitHub Desktop.
avoid throwing errors when Firebug is not installed
/**
* Avoid throwing errors when Firebug is not installed.
* See http://mattsnider.com/test/debugging-firebug-console-emulator/
*
* @todo as written this prevents using the console in WebKit.
*/
$.site.mes_getConsole = function() {
if (window.console && window.console.firebug) {
return window.console;
}
else {
return {
error: function() {},
debug: function() {},
info: function() {},
log: function() {},
warn: function() {}
};
}
};
$(function () {
if (! window.console)
window.console = $.site.mes_getConsole();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment