Secret to Debugging JavaScript in Safari
// February 2nd, 2006 // Technology Bits
The only major problem I’ve had with Apple’s Safari web browser has been its annoying lack of ability in debugging javascript. However, I was wrong to complain about that. Safari has a very good, detailed “Debug” menu which is far superior to any of the default debug abilities in any of the other major browsers. (This is of course without any plug-ins such as the Web Developer or Firebug in Firefox)
The problem really is that the “Debug” menu is disabled by default for everyone.
Safari Enhancer solves that problem. Install this simple program and with a single checkbox you can show all the nice goodies Apple has been hiding from us.



From the Safari Developer FAQ:
Unfortunately, the JavaScript debugger in Safari is as bad as the default error messages in Internet Explorer. But, being able to output to the console really makes up for it (almost). You can just do:
window.console.log("hello world");ooh, that’s even cleaner than the application I got, I’ll definitely use that method at home!
[...] Debugging difficult (not entirely true) [...]
window.print() / self.print()
both of them are not woking in safari 3.x.
You can access all of the defaults in the com.apple.Safari property list and turn them on or off.
In your home folder in your Finder:
Library > Preferences > com.apple.Safari.plist
double click to open it up in the plist editor.
eg, to turn debugging on, go to the IncludeDebugMenu pref, and change it to 1
How do you use debugging in safari on iPhone 3GS? I’m about ready to throw my phone.