I am debugging a Safari-specific javascript issue, and I can't get console.log
to output to the error log. This is a documented feature of Safari (I'm using version 4.0.3). These statements in my code just seem to be ignored, however. Why?
Thanks to Breton and SeanJA for their suggestions of testing directly in the console and making an example file. After doing this, I realized that console.log was, in fact, working in an isolated environment. This made me realize that it must be something particular to my development environment. Checking around, I found that there was some JavaScript being loaded early on, designed to define the console object for non-Firebug-enabled browsers.
if (!("console" in window) || !("firebug" in console))
{
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0; i < names.length; ++i)
window.console[names[i]] = function() {}
}
This was apparently written before Safari had implemented a console object for its error window.
I've removed that and now everything works well. Thanks, guys.
Are you using the mac or windows build?
On the windows build I can't use most of the stuff in the "Develop" men, none of the javascript options work for me. I can only use
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With