When the console is close and we call console.log from javascript most of the times
Internet Explorer will crash with the message:
Error: ‘console’ is undefined
Here is my solution for this annoying bug.
1 2 3 4 5 6 7 | if (typeof console == 'undefined') { var console = new Object(); console.log = function(){} console.error = function(){} console.debug = function(){} console.warn = function(){} } |
Thanks “brucebannor” for advice.
Have fun ![]()
Garry Lachman
One Comment
You’ve just saved my day !
I was wondering why my HTML5 app worked fine on every platforms except WindowsPhone
Thanks a lot, it did the trick;)
One Trackback
[...] JS: Prevent IE crash when using console (console.log) [...]