Last active
December 21, 2015 01:39
-
-
Save michalbcz/6229572 to your computer and use it in GitHub Desktop.
emulating window.console to prevent undefined errors for older browser (like IE7/8) which have no native console object or haven't got appropriate log methods
This file contains hidden or 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
| /* | |
| * Initialize console object used for logging in javascript code. | |
| * For case when console object is not present (old browsers) use dump implementation. | |
| */ | |
| window.console = window.console || {}; // in old browsers like IE7 there is no console object | |
| console.info = console.info || function() {}; | |
| console.error = console.error || function() {}; | |
| console.warn = console.warn || function() {}; | |
| console.debug = console.debug || console.info; // in later IE there is console but without debug method, so fallback to info |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment