Return to Snippet

Revision: 54626
at January 5, 2012 03:10 by Simounet


Initial Code
var alertFallback = false; // enable if you wanna see alerts msg
if (typeof console === "undefined" || typeof console.log === "undefined") {
    console = {};
    if (alertFallback) {
        console.log = function(msg) {
            alert(msg);
        };
    } else {
        console.log = function() {};
    }
}

Initial URL
http://stackoverflow.com/questions/690251/what-happened-to-console-log-in-ie8

Initial Description
Helps to manage console.log debug in js when broswing in IE. If alertFallback is enabled, you can see js alerts appears of vars tracked.

Initial Title
Manage console.log on IE

Initial Tags
ie, log

Initial Language
JavaScript