Fog Creek Software
g
Discussion Board




Debugging Javascript

Anyone know of a good IDE for client side javascript?

I am using Windows 2k/XP developing against Microsoft IE. I usually don't care about cross browser issues (ie Netscape).

Client constraints mean that .Net is often not an option.

I use Interdev and find debugging to be a hit or miss affair. I am looking for a similar IDE, but which works properly.

Preferably free, but I'll happily fork out if there's a trial version I can try.

Justin
Friday, February 6, 2004

Well you'd be better off with Venkman, the debugger with Mozilla and use Mozilla as the IDE, then test to make sure its valid within IE.

Simon Lucy
Friday, February 6, 2004

Yeah, I've looked enviously at the Venkman stuff. Non-IE browsers are outlawed though :(

Thanks, anyway.

Justin
Friday, February 6, 2004

The .Net IDE is a little better. It's what I typically use. Did Interdev have the "Running documents" window? I don't remember... it's pretty rad.

Aaron Boodman
Friday, February 6, 2004

Windows comes with a script debugger which gets invoked whenever a Javascript error occurs. You need to fiddle around with it though before you can effectively start debugging using that.

The only good way I know of (and use for) debugging Javascript is adding lots of "alert" statements. Not the most efficient, but gets work done quickly.

T-90
Friday, February 6, 2004

"fiddling" - where fiddling is:

1) tools > internet options > advanced > uncheck "disable script debugging".

2) tools > internet options > advanced > check "display a notification about every script error".

I used to be a devoted alert()er, but once I discovered tools > debug processes > IExplore.exe, > script (in VS.Net), I never looked back.

Another thing, if you need to manually trigger the debugger, you can insert the word "debugger" anywhere in your javascript code.

Not sure how much of this TOP already knew...

Aaron Boodman
Friday, February 6, 2004

Wow, I've never heard of that "debugger" command.  I need to try that.  Will the debugger then proceed over that line?

I've used a similar method where I just put an illegal command (like foo();), which causes it break and launch the debugger.  Then I can look at the DOM and get all sorts of static info, but I can't then continue on.

David
Friday, February 6, 2004

Just use things like

window.status = 'X = ' + X;

JS cowboy
Friday, February 6, 2004

"Wow, I've never heard of that "debugger" command.  I need to try that.  Will the debugger then proceed over that line?"

yeah, it essentially puts a breakpoint there. I think it's a hack on top of what you described. It even throws an error dialog and everything, just like a real error would - but then you are able to walk over that line.

Aaron Boodman
Friday, February 6, 2004

> Another thing, if you need to manually trigger the debugger,
> you can insert the word "debugger" anywhere in your
> javascript code.

Did not know of this one. Will definitely try this out. Thanks!

T-90
Saturday, February 7, 2004

*  Recent Topics

*  Fog Creek Home