Posted By

johnloy on 02/14/10


Tagged

javascript debugging firebug


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

ap3x


Prevent error messages in the cases where a console object doesn't exist


 / Published in: JavaScript
 

  1. // Prevent error messages in the cases where a console object doesn't exist
  2. if (!window.console || !console.firebug){
  3. var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml","group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
  4. window.console = {};
  5. for (var i = 0; i < names.length; ++i) {
  6. window.console[names[i]] = function() {};
  7. }
  8. }

Report this snippet  

You need to login to post a comment.