Manage console.log on IE


/ Published in: JavaScript
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. var alertFallback = false; // enable if you wanna see alerts msg
  2. if (typeof console === "undefined" || typeof console.log === "undefined") {
  3. console = {};
  4. if (alertFallback) {
  5. console.log = function(msg) {
  6. alert(msg);
  7. };
  8. } else {
  9. console.log = function() {};
  10. }
  11. }

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

Report this snippet


Comments


You need to login to view comments.