WK Integration Services Ltd

Seamless Solutions, Tailored Integration

Debugging JavaScript with Visual Studio.net

Debugging JavaScript with Visual Studio.net

The following piece of advice was taken from a blog (click here to see original) discovered while I was searching for a solution to debugging JavaScript in Visual Studio.
NOTE: Currently only works is IE, I have not investigated using Firefox.

ASP.Net makes it very easy to write and debug server side code. I’ve found when talking to ASP.Net developers that many of them don’t know that you can debug clent side script with VS.NET too.

This week I was working on a client web site and needed to to write some client-side JavaScript. This reminded me to post a quick how-to on client side debugging.

Steps

  1. Enable client-side script debugging in Internet Explorer
    1. Open Microsoft Internet Explorer.
    2. On the Tools menu, click Internet Options.
    3. On the Advanced tab, locate the Browsing section, and uncheck the Disable script debugging check box, and then click OK.
    4. Close Internet Explorer.
  2. In your JavasScript function add the keyword debugger . This causes VS.NET to switch to debug mode when it runs that line.
  3. Run your ASP.Net application in debug mode.

That’s all there is to it.


NOTE:You do not need to run Visual Studio in debug if you are only debugging the JavaScript, ie will pop up a dubug alert box when the “debugger;” piece of code is reached.

Leave a Reply

Your email address will not be published. Required fields are marked *