views:

34

answers:

2

Is there any helper code out there that will allow me to write to firebug's log window, but at the same time not break if using IE/chrome etc.

+1  A: 

A simple check for existence should work.

if ("console" in window)
    console.log("Log message!");

PS Chrome and IE7/IE8 have a console :-)

Andy E
+3  A: 

Put this at the top of your first JavaScript include:

if(console === undefined) var console = { log: function() { } };
Hooray Im Helping
+1 This is a pretty good suggestion. You could also do `var console = console || { log: function () {} };`
Andy E