Skip to content

Instantly share code, notes, and snippets.

@ethangardner
Created January 30, 2011 18:18
Show Gist options
  • Save ethangardner/803085 to your computer and use it in GitHub Desktop.
Save ethangardner/803085 to your computer and use it in GitHub Desktop.
Prevent console errors from IE if left in JS
// Prevents web inspector and firebug console errors from appearing in IE
// if a debugging flag is accidentally left in somewhere.
// originally from twitter.com
if (!window.console) {
(function() {
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() {}
})();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment