JavaScript Debugging with Safari

February 17, 2005
appleweb

If your doing web development or testing on Safari, JavaScript exceptions are quiet, like they are on most modern browsers (remember the days of annoying javascript error popups?). After looking around in the menus, or trying to type javascript: in the location bar (this brings up the javascript console in mozilla) you will soon find that there is no way to see your JavaScript exceptions by default.

Safari does in-fact have some handy debugging tools for web developers (DOM Tree, User Agent Spoofing, etc), but they are all hidden and disabled by default. The easiest way to turn on the debugging menu in safari is by installing Safari Enhancer.

Safari Enhancer Screen Shot

Make sure you check the box Debugging Menu, you can see that there are also some other handy features in Safari Enhancer. Click Apply Lasting Setting when your done.

Safari should reload and you will have a new menu called Debug

Screen Shot of Safari Debug Menu

Check Log JavaScript Exceptions in the debug menu. Now javascript exceptions will show up in your Console log (Applications / Utilities / Console).


10 people found this page useful, what do you think?

Comments

Well, if you call things like ":TypeError - Undefined value" a useful error message... No line number, no source code, nothing useful really.
how about this: (event handler):Undefined value yeah, that's greatly helpful. Thanks Apple!
It seems like the Page Load Test and "Sample" files that Safari generates might be handy, but I can't find any information on how to use either of these capabilities that appear in the Debug menu. Does anyone have any information on how these features work?
I get "SyntaxError - Parse error Line 1". Really useful. </sarcasm> Considering that Safari's scripting support is pretty-much as non-standard as any other browser, they should really include decent debugging tools if they expect anyone to support their platform.
I actually enabled the debug menu via the Terminal. My JavaScript console displays error with the line number visible and when you double-click on the error it will launch the js file in source view and hightlight the line that is giving the error.
I got NULL value error, and there is line number. It is really hard to debug in the case. I have been using Safari Enhancer
I also got a NULL value, only in Safari. It came from an Ajax empty xml tag. The value should be an empty string, not a null value...
Does anybody know if one can debug using Windows Safari? Regards, Michael http://news.buzzyventure.com/0000/michael_bolton.htm
To view the error console for Safari on a Mac, go into the Terminal application and issue this command (write it all on one line):
defaults write com.apple.Safari IncludeDebugMenu 1
I HAVE THE PROBLEM OF HAVING SLOW SCRIPT ON MY IMAC WHEN I USE FACEBOOK. THEN I TRIED DOING ALL THINGS TO FIX IT. THEN I FOUND THAT YOU CAN FIX IT DOING WITH THE JAVASCRIPT EXCEPTION THING. BUT WHEN I COPY AND PASTE
defaults write com.apple.Safari IncludeDebugMenu 1
THOSE THINGS IN MY TERMINAL IT DOESN'T WORK THEN THE DEBUG MENU DOESN'T OPENS. I DON'T KNOW WHT TO DO.. HELP PLZ.. I WILL GET IN TROUBLE.. PLZZZZ

Post a Comment




  



Spell Checker by Foundeo

Recent Entries



foundeo


did you hack my cf?