Wednesday, January 14, 2009

Debugging Javascript

If you have Visual Studio 2008 you can debug javascript just like you debug C sharp cod.Just put a break point and run your project using the F5 key. But what if you don't have ??
All you have to do is add the debugger keyword on your javascript code where you want to debug.
When the code is executed IE will ask you if you want to debug and list the programs you have to debug the code. This technique also works with firefox+firebug.
To turn on javascript debuggin in IE you have to go in Tools->Internet Options and on the advanced tab uncheck the "Disable script debugging".
Be aware that this can cause the browser to show you errors in all sites ( and believe me there are a lot out there).

No comments: