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.
views:
34answers:
2
+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
2010-05-12 16:56:54
+3
A:
Put this at the top of your first JavaScript include:
if(console === undefined) var console = { log: function() { } };
Hooray Im Helping
2010-05-12 16:56:57
+1 This is a pretty good suggestion. You could also do `var console = console || { log: function () {} };`
Andy E
2010-05-12 16:59:28