Skip to content

Instantly share code, notes, and snippets.

@sillero
Created December 20, 2012 13:20
Show Gist options
  • Save sillero/4345292 to your computer and use it in GitHub Desktop.
Save sillero/4345292 to your computer and use it in GitHub Desktop.
js console polyfill/ie-protection
(function (con) {
// the dummy function
function dummy() {}
// console methods that may exist
for(var methods = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(','), func; func = methods.pop();) {
con[func] = con[func] || dummy;
}
}(window.console = window.console || {}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment