Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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