Tip: the MS Script Debugger
I'm surprised that more JavaScript developers don't know (or maybe have forgotten) about the Microsoft Script Debugger. If you're weary of IE script errors that report "Line 324: Object expected" and no filename when you have 500K of script divided over 12 files, install this beastie, then open IE and go to Tools > Internet Options > Advanced and uncheck "Disable Script Debugging (Internet Explorer)."
Restart IE and the next time you encounter a JS error, a dialog box should pop up asking you if you wish to debug it. Clicking OK will launch the debugger, taking you to the file (hallelujah!) and the line at which it occurred.
It's not specifically tailored for JS like Venkman, but it's waaaaay better than IE's native JS error reporting.
7 Comments:
The reason I *stopped* using the debugger was that shutting down the debugger also shut down IE. That's the most annoying thing in the world. Has that been fixed now? Must test it again.
Stuart - I think that has changed now, however I think the "Debug...Stop Debugging" menu item would detach from the process so you could close the window without killing IE. Certainly, if you're debugging with Visual Studio, you can select "Debug...Detach all processes" from the menu with that effect.
The Visual Studio debugger is pretty well every bit as good as and sometimes better than Venkman but for IE. In VS 2005, you don;t even have to add vars to the watch window, you can hover and get a popup of a full object tree.
I'm certainly not an MS-worldview advocate, but you'd be missing out if you didn't try Visual Studio for Javascript debugging.
I seem to remember that just clicking the [X] button on the debugger would take down IE with it, but recently I find if I do File > Close instead, it leaves IE running. (Maybe it's always done that.)
If you have Visual Studio or Office you are much better off using them for debugging (debugging via office). The Office and VS debuggers are the same and are infinitely more useful than the MS Script Debugger.
Note that browser based on IE, such as Avant Browser or Maxthon, turn on the "Disable Script Debugging" option when they start. Very annoying, and one of the reasons I swtiched to Firefox for tabbed navigation.
Maxthon have an option to disable this annoying behavior, though.
The reason I no longer use the MS Script debugger is because when you install it, you also appear to install a scripting engine that's slightly different from the one that comes as standard with Windows.
This means you risk users seeing bugs that never appeared in your devlopment environment. That sucks.
Maybe if IE's javascript engine wasn't a giant piece of crap, we wouldn't be as reliant on debuggers as we are now.
Post a Comment
<< Home