user14563
user14563

Reputation: 51

Cross-browser JavaScript debugging

I have a few scripts on a site I recently started maintaining. I get those Object Not Found errors in IE6 (which Firefox fails to report in its Error Console?). What's the best way to debug these- any good cross-browser-compatible IDEs, or javascript debugging libraries of some sort?

Upvotes: 1

Views: 722

Answers (10)

Glenn
Glenn

Reputation: 200

In response to mopoke, for IE6 you definitely want to use Visual Studio for debugging if you can get it. For all intents and purposes, the MS script debugger is useless. You're better off using some form of tracing (not alerts) than using the MS script debugger. Dojo Toolkit, for instance, provides a debug console for tracing, but you can write your own by dumping messages to a secondary window or div.

The script debugger needlessly prompts you on each error in IE6 and even then doesn't give you enough state context to make it useful in a sufficiently complex JS app. Visual Studio is more tightly integrated and much friendlier. Just my experience.

Upvotes: 0

Tyler
Tyler

Reputation: 28874

Firebug seems to be the most useful so far. When a page is running on firebug, it can be very handy to log messages into firebug via javascript calls to console.log('your log message'); but don't execute that code in IE since the console object is only in scope when firebug is running.

For IE, other folks have mentioned the Script Debugger. Although it is not primarily for javascript debugging, it can be useful to also add the IE developer toolbar, which allows you to easily and dynamically inspect the style and other properties of your page's DOM.

Upvotes: 0

Kristian J.
Kristian J.

Reputation: 10442

To make the Microsoft Script Debugger more user friendly (and to add javascript error messages that actually are helpful to IE), I highly recommend Companion.JS.

Upvotes: 0

Darren Newton
Darren Newton

Reputation: 2877

You could also use Firebug Lite - which will work in IE & Opera. It's an external lib that will help you track down problems. It's sometimes more convenient than dealing with the MS Script Debugger.

Upvotes: 2

madcolor
madcolor

Reputation: 8170

Firebug is the best all around client-side debugger. I frequently use it to debug CSS code as well as javascript. It allows you to easily find offending areas of code. I especially like the ability to modify tag attributes in the firebug pane and see the effects immediately before committing. Very useful for anyone designing websites.

Upvotes: 1

David Negron
David Negron

Reputation: 1356

Aptana Studio provides JavaScript debugging for Firefox and IE

Upvotes: 1

Svet
Svet

Reputation: 3655

You could use this tool apparently - Microsoft Script Debugger

Personally I try to go through the code and figure out what's going on - it gives you the line number where it goes wrong right?

Upvotes: 0

dimarzionist
dimarzionist

Reputation: 18687

  1. You can use Visual Studio and enable debugging in browser
  2. You can install FireBug plugin for Firefox, it's really good!
  3. You can try to install IE8 beta 2 and use it in compatibility mode with built-in debugger.

Also in any line of your JS code you can write

debugger;

and this will be threated as breakpoint for any of the debug tools you use.

Cheers!

Upvotes: 1

mopoke
mopoke

Reputation: 10685

There's no cross-browser JS debugger that I know of (because most browsers use different JS engines).

For firefox, I'd definitely recommend firebug (http://www.getfirebug.com)

For IE, the best I've found is Microsoft Script Debugger (http://www.microsoft.com/downloads/details.aspx?familyid=2f465be0-94fd-4569-b3c4-dffdf19ccd99&displaylang=en). If you have Office installed, you may also have Microsoft Script Editor installed. To use either of these, you need to turn on script debugging in IE. (uncheck Tools -> Internet Options -> Advanced -> Disable Script debugging).

Upvotes: 3

William
William

Reputation: 6428

Firebug

It's only for firefox but it should let you figure out what's happening on IE especially once you have the script line numbers.

Upvotes: 1

Related Questions