Debug JavaScript in IE
Aug
01
I ALWAYS use Firefox to debug my JavaScript code. There are plenty of plugins that allow for you to easily debug problems in your code. But what about when your code runs perfectly fine in Firefox, but not in IE? How do you debug your JavaScript code in IE? I've finally found the answer:
Step 1 - Enable script debugging.
Now the process for doing this is obvious. Go to "Tools -> Internet Options... -> Advanced". From here, find "Disable Script Debugging (Internet Explorer)", and "Disable Script Debugging (Other)". Now, follow me here... To enable script debugging, you need to uncheck these boxes. Very intuitive, I know. Once you've unchecked these two boxes, click "OK".
Step 2 - Open up your debugger.
To access your debugger, run your script (i.e. reload
your html page, and trigger the JavaScript). A new pop-up
message should appear.

Click Yes. Doing so, will bring up another
window.

There are three applications available for script debugging:
"Visual Studio.Net", "Microsoft Script Debugger" and
"Microsoft Script Editor". You may be limited in your
choices, however (see image). Choose the debugger from the
list, and click Yes. This will bring up the
debugger, which will most likely take you to the line of
code that is causing the problems.

There you have it. A way to debug JavaScript in IE.
Hints and Other Articles
- Type "javascript:debugger;" in the address and hit enter to open up your debugger.
- Type "if(typeof(res)=="object") debugger;" in your code to launch the debugger at a break point.
- Scripting Debugging in Internet Explorer
- Debug Internet Explorer Javascript
- HOW-TO: Debug JavaScript in Internet Explorer
Hopefully this helps take away some of the pain that is Internet Explorer.

- Tagged as: annoying, browsers, debugging, frustrations, IE, opinions, rant
- Categorized under: JavaScript, Web Development
