Scripting Debugging in Internet Explorer


The information published in this post is now out-of-date and one or more links are invalid.

—IEBlog Editor, 20 August 2012

I thought I’d take a couple minutes to talk about Script Debugging and Internet Explorer.

Script debugging is turned off by default you can enable it by going to:
Tools->Internet Options…->Advanced->Disable Script Debugging

Prior to XPSP2 the above will turn script debugging on for all applications that host the WebBrowser control (Outlook for example).

On XPSP2 we’ve split the option into two:
Tools->Internet Options…->Advanced->Disable Script Debugging (Internet Explorer)
Tools->Internet Options…->Advanced->Disable Script Debugging (Other)

When you’ve enabled Script Debugging ‘View->Script Debugger’ will now be present to help you break into the debugger.

The debugger statement can also be placed anywhere in your code to suspend execution this is similar to setting a breakpoint.
The Stop statement is the VBScript version of JScript’s debugger statement.

There are three applications which I’ve used for script debugging.  One is Visual Studio.Net, the second is Microsoft Script Debugger and the third is Microsoft Script Editor:

Miscrosoft Script Debugger:
You can obtain a copy of the Microsoft Script Debugger here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=2f465be0-94fd-4569-b3c4-dffdf19ccd99&displaylang=en

The main MSDN page for using the Microsoft Script Debugger can be found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdbug/Html/sdbug_1.asp

The Microsoft Script debugger allows you to debug client side and server side scripts and provides the same functionality as most debuggers do.

Directions on using the Microsoft Script debugger can be found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdbug/Html/sdbug_2.asp

Microsoft Script Editor:
The Microsoft Script Editor comes free with Microsoft Office XP/2003 with FrontPage.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfp2k2/html/odc_fpdebugscripts.asp
 
Visual Studio.net:
For Visual Studio.net debugging Monica Rosculet has written an excellent article on: Debugging Script Code Using Visual Studio.

Other:
Gregg Miskelly a developer on the Visual Studio team has posted some excellent information about: How Script Debugging Works.

-Phil Nachreiner

Comments (70)

  1. Anonymous says:

    Why is is that the ‘debugger’ statement doesn’t always trigger something in the script engine. Sometimes the script engine will just ignore it. I’ve found that moving the statement around within a function can effect whether the debugger will get picked up. This has been going on since IE5 was released.

  2. Anonymous says:

    I have to say, i find the script debugger in FireFox a lot easier to use whne trying to debug js

  3. Anonymous says:

    minghong, thanks. I’ve corrected the debugger statement link so that it now points to the the MSDN online library.

  4. Anonymous says:

    The debugger feels far more ‘integral’ to Firefox. Like it or not, more clueless users are becoming power users. If the IE team tries to fight the transition, then they will lose, and this isn’t even talking long-term. Empower your users!

  5. Anonymous says:

    Dave, have you seen this behavior with the debugger statement with Script debugging turned on?

    With Firefox are you using the Javascript Console or another plug-in debugger like: Venkman?

    Thanks for your feedback 🙂

  6. Anonymous says:

    I agree that IE could use something more simple and lightweight, like Firefox’s Javascript Console. I’ve done work on sites where I made a simple error in the client-side scripting and IE would ask me if I want to start the debugger, I say yes, click OK about 6 times and then have the Script Debugger tell me it can’t get the code to show me the problem. Of course I have no idea what’s going on, because IE never gave me any clue about the error. Firefox will show a debugger-quality error message, complete with the offending line marked where the error occurred and its line number. In my opinion, Firefox simply has better usability in this area. I’ve used Venkman briefly for a few heavy javascript things, and it’s amazing!

    IE devs: The majority of people that care about this blog are web developers who want to see the next IE make their lives easier. Script debugging is yet another area where the competition has you beat. We want to see some innovation!

  7. Anonymous says:

    About debugging, I tried to switch off Javascript in IE 6 SP1 the other day, this was due to that we have to support IE because of the market share, otherwise we wouldnt care. But anyway, we disabled everything on all zones with no luck. Why does it have to be so difficult? Why not like Firefox or other browsers where you can easily uncheck the "enable Javascript" checkbox?

    Also, due to several Javascrip errors i downloaded Microsoft Script debugger, sometimes when i got an error and it asked me to debug, it opened up the program and no code in the window, just a blank windows.

    In Firefox, when you get a javascript error, you can click on it, and automatically it will hightlight the line where the error occured, doesnt matter if its an included js file or not.

    Not to mention how to find out to acutally enable error reporting without restarting the browser… Really bad user experience for a web developer. Pitty

  8. Anonymous says:

    Personnaly I nearly never need all the breakpoints and things. What I do often need are error messages that give real line numbers instead of some psuedo-random integer based on some internal version of the page thats inaccessible to me.

  9. Anonymous says:

    "IE would ask me if I want to start the debugger, I say yes, click OK about 6 times and then have the Script Debugger tell me it can’t get the code to show me the problem"

    yeah, the script debugger gets severely confused when it comes to included javascript files….. makes debugging a royal pia

  10. Anonymous says:

    last i checked, Netscape’s javascript debugger was way better.

  11. Anonymous says:

    Phil, i’m just using the js console that comes with FireFox as standard. I will definatly try Venkman though.

    What everyone else has said pretty much sums up my feelings. The ff js console is just so much quicker and easier.

  12. Anonymous says:

    How on earth does one debug an ASP script?

    I can’t seem to get it to work as I think it should. I’ve got IIS 6 (win 2003) set to debug ASP server side. I’ve got script debugger installed. I run a script with a deliberate divide by zero error in it, and I get nothing. Just a normal error message in IE as always.

    What am I missing!

  13. Anonymous says:

    For the life of me I cannot get script debugging working after installing Web Developer Express. I’ve tried installing Microsoft Script Debugger again, and it will actually pop up when an error occurs, but the window is completely empty (no source loaded.)

    I’m ripping my hair out. Any help would be appreciated.

  14. Anonymous says:

    I am having the same problem as Nicholas. The debugger opens but it is blank. I am not running SP2. Could that be the problem?

  15. if you ever have to debug javascript in internet explorer, you really want to go and download the free visual…

  16. Microsoft-Entwickler wissen um die Vorzüge von ASP .NET, und einige der NETzWERK-Mitglieder haben sich…

  17. IEBlog says:

    Hi there!   My name is Laurel Reitman and I’m a Lead Program Manager on the Internet Explorer…

  18. I had a difficult problem with broadcasting powerpoint presentation. The tool I want to use can be found…

  19. From an IEBlog I’ve finally found how you can debug JavaScript ising Microsoft Internet Explorer. This article discusses the things you need to enable and install on your MS Windows machine.

    Unfortunately I still don’t understand why the script I use

  20. Selenium Core FAQ This is an initial list of FAQs that have been collected for Selenium Core. We encourage people to add to this list and continue feedback on the items listed below: # (?) What is Selenium for?…

  21. BuBlog says:

    Γενικά βρίσκω πολύ χρήσιμο να κάνω debugging σε ότι φτιάχνω.. Πρόσφατα χρειάστηκε να φτιάξω κάτι σε JavaScript

  22. PeteL's Blog says:

    We had a great chat today, thanks to everyone who came out, and to Chris, Markus, Alex and Dave who were

  23. FirefoxであればFirebugで簡単に問題の場所をみつけられますが、IEでjavascriptのエラーが出ると、素っ気な…

  24. ohio state university football stadium

  25. 上校 says:

    使用最好的开源工具处理Web页面、脚本和样式,简化新站点和页面的开发。动态检查和修改HTML标记、CSS和JavaScript,检查DOM以及客户机-服务器通信并了解bookmark…

  26. Malick says:

    Very helpful thank you.

Skip to main content