I always end up leaving debug code in my pages for one reason or another. One of which is console.log() for the firebug extension. Now, if you leave this and a user opens your page on IE or something like that, they will get an error.

Put the following code into a JS file, like your base file. And it will check for the existence of console and avoid the problem.

if (!window.console) {
    window.console = {};
    window.console.log = function() {};
}

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.