views:

630

answers:

2

I was wondering if the type of javascript errors can be grouped into different categories and if there was an easy way of debugging them. While working on a ASP.NET application, I generally see 2 different types of JS errors:

  1. Ones that say "Error occurred in xx. Do you want to debug"?

  2. Ones that show errors with a icon on the bottom left side of the browser (When you double click, the error shows up)

Is there a good debugger for all JS errors (especially the ones with type 1?)

EDIT-

If I use Visual Studio to debug JS, can I have it setup to automatically open the line that caused the error in VS when I am not in debug mode? (We have a large .NET solution and to get to the JS debugger, I have to start in debug mode (The script explorer does not show up if I simply attach the debugger later))
+3  A: 

There certainly is: Firebug. It's a plugin for Firefox and you simply cannot developer a website without it.

Edit for more info.

The 'type 1' error you are talking about occurs in IE only. And you can debug it using a copy of Visual Studio.

Not that you would want to however. Just get Firebug and you'll wonder how you ever developed without it before.

DaRKoN_
+2  A: 

Javascript runs on the client, so it doesn't really matter that you're using ASP.NET. There are several options for debuggers, and for the most part it just depends what browser you're using. The firefox plugin Firebug is considered by many to be the best javascript debugger. Debugging in IE7 can be painful. You can use Visual Studio to debug your "type 1" errors. I run IE8 in IE7 compatibility mode. IE8 has a decent builtin script debugger. Unfortunately, it doesn't do everything exactly the same as IE7.

Bryan
+1: Good comprehensive answer.
Cerebrus