Thursday, May 21, 2009

How to Debug JavaScript Using C#

1 comment
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. 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.

Go to Tools>>Options >> and refer image below.







You can also download code from http://www.4shared.com/file/106977680/64e2c2b2/DebugJavascript.html

Now open your code and put Debugger; key word in your code. Refer image below





Now run your code, on IE. You will find and window. Refer image below.







Click yes to start debugging. It will take some time to open debugger because you are debugging first time. Refer Image below.









Now, you can easily debug your Java Script code with VS debugger.

Hope this code will help you to come out from hectic task to Java Script Debugging.

You can also use Fire Bug to debug your code on Mozilla Firefox.

You can also refer following links for more help:
http://support.microsoft.com/kb/816173
http://dotnetsavvyblog.blogspot.com/2007/11/how-to-debug-javascript-dom.html





1 comments:

Shakti Singh Dulawat said...

nice things, but narender I saw that IE 8 has a facility to debug java script...
Thanks
Shakti