Make console methods work in Internet Explorer

by
, posted

Update: use Paul Miller’s solution, not mine.

In short: if you want the console to work in IE, use Firebug Lite. If you just want it not to crash, see the files at the bottom.

The web console is really useful, but it’s not supported in (surprise) Internet Explorer. While you probably don’t want to have console.log in your production code, you don’t want to have your site break in IE because you use the console. In this case, you have two options.

If you want it to actually work, Firebug Lite is the way to go. This makes the console actually show up and work.

If you just want it to not crash (like I do), use some code I wrote. I wrote some simple code that makes any non-existing console methods a no-op. I made a bunch of different versions. The terse versions only fix the common log, info, warn, and error; the “complete” versions are more thorough. There are JavaScript and CoffeeScript versions.

Enjoy!