Debugging Javascript in Visual Studio .NET

Just a reminder to myself but this can be useful if you are dealing a lot with Ajax stuff!

- Open in Internet Explorer Tools -> Internet Options -> Advanced tab.
- Deselect the following (make the checkbox unchecked):

[ ] Disable Script Debugging

- Restart IE.
Now just add the following line of code to your JavaScript - it'll work as a breakpoint:

debugger;

Visit your page with the javascript using your fresh instance of IE, a window should prompt you to select a debugging environment. Select the MSVS.NET instance you have opened (or you could select 'New instance of Microsoft Development Environment'), and click 'Yes'.

Another window will prompt you to 'Choose the program types that you want to debug:' - make sure 'Script' is the only option selected, and click 'Ok'

Enjoy!

2 Comments

Comments have been disabled for this content.