Debug Internet Explorer Javascript

Only one tip that I didn't know before: When you want to debug Javascript code you can start your debugger (Visual Studio .NET or Script Debugger), search for the correct iexplore.exe process, attach it and go on debugging.

A very fast way is to write "javascript:debugger;" in the address line, select your debugger and start debugging. Also, the "debugger;" command can be used in Javascript code:

if(typeof(res)=="object") debugger;

This line will start the debugger if the type of res is object.

Published Tuesday, April 19, 2005 4:17 PM by Michael Schwarz

Comments

# re: Debug Internet Explorer Javascript

Tuesday, April 19, 2005 11:34 AM by Charles Chen
Or you could just use FireFox...

It's leaps and bounds above IE from a developers standpoint.

+ JavaScript Console
+ DOM Inspector (!!!!)
+ Form Info (lists all form inputs; from Page Info menu item)
+ Links (lists all links on page; from Page Info menu item)

# re: Debug Internet Explorer Javascript

Tuesday, April 19, 2005 2:33 PM by Dave
Be warned though.
Sometimes the debugger; statement doesn't always kick in.
You may have to move it around in your code for it to actually activate the script debugger.

This has been going on since IE 5.

# re: Debug Internet Explorer Javascript

Thursday, April 21, 2005 8:53 PM by Bertrand Le Roy
Charles, whatever the qualities of Firefox are, the whole world is not yet using it, so there is still a need to test web sites on IE. Furthermore, the Firefox tools you mention are very far from what a full debugger can offer.
It seems like every time a blog post contains the words "Internet Explorer", there's someone who will claim that Firefox is better even if it has no relevance whatsoever to the subject of the post.

# re: Debug Internet Explorer Javascript

Friday, April 22, 2005 4:49 PM by Costis
Bertnard, Charles suggested that Firefox is a better debugging tool than IE for Javascript. The subject of the post is a tip on how to debug client Javascript, so Charles' posting was relevant.