The default script debugging is disabled. To enable it, you must:
Tools-> Internet Options... -> Advanced-> disable script debugging
On XP SP2, the options are split into two items:
Tools-> Internet Options... -> Advanced-> disable script debugging (Internet Explorer)
Tools-> Internet Options... -> Advanced-> disable script debugging (other)
After you enable script debugging, the menu item 'view-> script debugger' will become visible. You can use it to break the file into the debugger.
Generally, three types of Debugger are used: Visual Studio, Microsoft Script debugger, and Microsoft Script Editor.
To put it simply, the script debugging in Visual Studio.
Method 1: For example, there is a page containing JavaScript HTML.
- Enable script debugging in IE (see image: Tools-> Internet Options-> advanced)
- Open the HTML file in Visual Studio
- Set a breakpoint and hit F5/start debugging or hit F10/F11 to single step
The rest is just like debugging.ProgramSame.
Method 2: If the application cannot be started by clicking F5 in Visual Studio, for example, the script is still on the server before the debug starts, the second method is required.
- Open the web site in Visual Studio and open the. js file for editing
- Set a breakpoint at a suitable place in the. js file (eg in the this. initialize function)
- In Visual Studio go to debug-> attach to process
- Ensure that either automatic or script is selected as the type of code to debug (see images below)
- Select the relevant ie process from the available process and click "Attach" (see image below)
- Return to IE and load up the gadet (or reload it) and the breakpoint shoshould fire and you'll drop back into Visual Studio as before
The only unpleasant thing is that you often need to go in and out in the "attach to process" dialog box. This disadvantage is not worth mentioning compared to the powerful functions of Visual Studio.
If you want to open a new browser in Visual Studio, you can select a page in Solution Explorer, right-click and choose "Browse with". Here you can change the default browser.
Original article:
Script debugging with Visual Studio
http://blogs.msdn.com/mikeormond/archive/2006/01/13/512496.aspx