Last active
August 29, 2015 14:25
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(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