Skip to content
Fix console wonkiness in older versions of IE
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
LICENSE.md
README.md
bower.json
console-shim.js
package.json

README.md

console-shim.js

Protect window.console method calls, e.g. console is not defined on IE8 unless its dev tools are open. IE also doesn't define goodies like console.debug, which can break your entire website if you aren't careful.

Installation

Install with Bower:

bower install --save console-shim.js

Usage

Paste or otherwise load the code at the top of your JavaScript (before using the console).

More complete alternatives

The goal of this library/snippet is to just be small and make IE shut up about errors. It is not a substitute for the various actual console methods themselves. You can find a more complete solution here.

Acknowledgements

Shamelessly inspired by Peter Tseng's answer in this StackOverflow conversation

Something went wrong with that request. Please try again.