Devin Rader's Blog
I write the code...

Debugging JavaScript in VS2003

Monday, October 31, 2005 6:26 PM

Just a quick tip in case you ever need/want to be able to debug JavaScript from Visual Studio.

  1. Open up the Internet Options in IE
  2. Open the “Advanced“ tab
  3. Make sure that the “Disable Script Debugging” option is unchecked
  4. Make sure the “Display a notification about every script error is checked

Once you have set up the internet options, then all you need to do is where ever you want the javascript code to break, add the debugger; command. 

Now when you run your app in in VS debugger, Visual Studio will break on the debugger statement and let you step through the client side code.  Of course, if there is an error in the code, VS will automatically break and let you step into the offending code to debug the problem.  Another great feature is that you can use the VS Command Window and Watches to examine contents of your JavaScript objects.



  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Feedback

# re: Debugging JavaScript in VS2003

thanks a lot!! 12/15/2007 6:29 PM | just me

# re: Debugging JavaScript in VS2003

Thanks ,it realy helped me 3/28/2010 3:43 AM | mohammed

# re: Debugging JavaScript in VS2003

You'll find the above statement very useful in detecting "form deteched controls because of improperly closed tag".Anyway, you'll want to insert window.alert() statement everywhere when
debugging to act as breakpoint for your javascript functions.And I also find the "Javascript Console" of Firefox very useful..... 4/21/2010 6:28 AM | meilleur casino en ligne

Post a comment