JavaScript Debugging with Safari

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?

Trackbacks

Trackback Address: 230/AC55A652915DE15CEF0427C9B31CC06E

Comments

On 02/22/2005 at 11:47:34 PM EST Bertrand Le Roy wrote:
1
Well, if you call things like ":TypeError - Undefined value" a useful error message... No line number, no source code, nothing useful really.

On 03/07/2005 at 1:29:58 PM EST jay wrote:
2
how about this:

(event handler):Undefined value

yeah, that's greatly helpful. Thanks Apple!

On 03/25/2005 at 3:33:51 PM EST scott wrote:
3
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?

On 03/08/2006 at 11:55:38 PM EST Rich wrote:
4
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.

On 09/11/2006 at 11:15:44 AM EDT Jonathan wrote:
5
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.

On 04/22/2007 at 6:57:28 PM EDT Charlie wrote:
6
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

On 11/03/2008 at 8:17:55 PM EST davide wrote:
7
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...

On 11/14/2008 at 2:11:24 PM EST David wrote:
8
Does anybody know if one can debug using Windows Safari?

Regards,

Michael http://news.buzzyventure.com/0000/michael_bolton.htm

On 12/01/2009 at 1:17:13 PM EST Capra wrote:
9
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

On 04/03/2010 at 10:21:47 PM EDT dawa wrote:
10
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?