Skip to content

Instantly share code, notes, and snippets.

@karthikbgl
Last active August 29, 2015 14:25
Show Gist options
  • Save karthikbgl/bd33c946e7ed1e4463f2 to your computer and use it in GitHub Desktop.
Save karthikbgl/bd33c946e7ed1e4463f2 to your computer and use it in GitHub Desktop.
console.log messages in code are bad for Internet Explorer <= 9. This plugin would avoid the application from crashing when console.log messages are present in the javascript code.
;(function () {
// console.log statements cause issues in Internet Explorer <= 9.
// This piece of code prevents the application to fail
// Source for console: https://developer.mozilla.org/en-US/docs/Web/API/Console
var fns = [
"assert",
"count",
"debug",
"dir",
"dirxml",
"error",
"exception",
"group",
"groupCollapsed",
"groupEnd",
"info",
"log",
"timeStamp",
"profile",
"profileEnd",
"time",
"timeEnd",
"trace",
"warn"];
var funcName,
var noop = function () {};
if (!window.console) {
window.console = {};
while (funcName = fns.pop()) {
window.console[funcName] = noop;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment