Debugging client JavaScript in VS 2005
2007-08-23 15:27
525 查看
Client Java Script is one of the most important things in web development but not the best and easiest to develop. Building of bigger and more complicated scripts, especially using DOM model or form field values can cause a lot of frustration and head pain. Moreover, JavaScript debugging is not easy and obvious as should be. But there is a hope.
One of less known features of Visual Studio 2005 is Script Explorer, hidden in Debug menu where appears only when the debugger is running. This great tool allows easily debug JavaScripts.
Before start, we should ensure that client script debugging is not disabled in IE as it is by default. Suitable options are located on Advanced tab of Internet Options where both script debugging checkboxes should be unchecked.
We can come back to Script Explorer. As it was written before, it appears only while the debugger is working. So after starting project we can go do Debug->Windows where should be Script Explorer. Sometimes, don’t know why, it doesn’t so in this case we have to find it manually. Staying in debug mode right click on tool bar and go into Customize. Then select Debug in Categories on the left side of window and find Script Explorer on the right. Just drag it to Debugging toolbar.
After opening Script Explorer panel we will se the tree of active JavaScripts. At the first level are scripts that are imported from external sources or embedded in the page. There are also auto-generated scripts like postback scripts as well. By double-clicking on the selected script it will open in the main window.
At this moment, we can debug it in well known way using breakpoints, steps, Watch and QuickWatch, just like in the server side, including context variable browsing.
Breakpoints can also be set up in external *.js files before project will be loaded. Then, after loading project, the breakpoint will be activated by debugger. Note, that it is only possible to *.js files not for scripts embedded in pages. These scripts are available for debugging only after loading page.
http://www.developerfusion.co.uk/show/5918/
One of less known features of Visual Studio 2005 is Script Explorer, hidden in Debug menu where appears only when the debugger is running. This great tool allows easily debug JavaScripts.
Before start, we should ensure that client script debugging is not disabled in IE as it is by default. Suitable options are located on Advanced tab of Internet Options where both script debugging checkboxes should be unchecked.
We can come back to Script Explorer. As it was written before, it appears only while the debugger is working. So after starting project we can go do Debug->Windows where should be Script Explorer. Sometimes, don’t know why, it doesn’t so in this case we have to find it manually. Staying in debug mode right click on tool bar and go into Customize. Then select Debug in Categories on the left side of window and find Script Explorer on the right. Just drag it to Debugging toolbar.
After opening Script Explorer panel we will se the tree of active JavaScripts. At the first level are scripts that are imported from external sources or embedded in the page. There are also auto-generated scripts like postback scripts as well. By double-clicking on the selected script it will open in the main window.
At this moment, we can debug it in well known way using breakpoints, steps, Watch and QuickWatch, just like in the server side, including context variable browsing.
Breakpoints can also be set up in external *.js files before project will be loaded. Then, after loading project, the breakpoint will be activated by debugger. Note, that it is only possible to *.js files not for scripts embedded in pages. These scripts are available for debugging only after loading page.
http://www.developerfusion.co.uk/show/5918/
相关文章推荐
- Debugging client JavaScript in VS 2005
- 『转』JavaScript Debugging and Intellisense, JavaScript obfuscator etc from VS 2005 to VS 2008 (VS2005到2008的变迁,JavaScript调试,智能感知/智能感应功能,JavaScript的混淆、压缩等功能的海变桑田)
- JavaScript debugging in VS.NET 2003
- 如何在 VS 2005 里调试 Javascript
- JScript Debugging in Visual Web Developer 2005
- “A first chance exception of type…” Messages in VS 2005
- (1,eval)('this') vs eval('this') in JavaScript?
- New Feature In the VS.Net 2005 Editor
- Problem in connecting VS 2005 to SQL Server 2008
- Truthy Vs Falsy Values in JavaScript
- enable emulator in vs 2005 connect to active sync
- 如何在 VS 2005 里调试 Javascript http://blog.joycode.com/saucer/archive/2006/10/26/85679.aspx
- First example In VS.NET 2005 Beta2(Script Callback)
- ContextSwitchDeadlock was detected when debugging in Visual Studio 2005
- 利用VS 2005调试 JAVASCRIPT的两种方法
- VS 2005 Add-in开发随笔
- Inline vs. External Javascript
- VS 2005中调试JavaScript的方法
- 如何在 VS 2005 里调试 Javascript
- Add web application project in VS 2005