Welcome to Dovetail Software Blogs : Sign in | Join | Help
Web Developers: Make sure you're displaying script errors

By default, Internet Explorer doesn't display script errors. Most of the time this is fine, but when developing web applications, you want to be aware of any script errors.

For example, lets say you have this line of BLOCKED SCRIPT

var foo = document.getElementByid('bar').value;

Notice that the "i" in getElementByid is lowercase, which isn't valid.

By default, IE won't display an error. The only indication that an error occurred will be an icon in the status bar (if you even have the status bar displayed, which you may not):

error

Double-clicking the icon will give you more details:

details

When I'm developing web apps, I want to know when there's an error, so I configure IE to always display errors.

IE - Tools - Internet Options - Advanced Tab

Make sure the Display a notification about every script error option is checked.

ie_options

 

In addition, I also uncheck the "Disable script debugging" checkboxes, which gives me the option to step into the code in Visual Studio:

debug_confirm

If I choose Yes, then I can see exactly the line of code throwing the error:

debug

 

Developing in Firefox? You still should be testing your app in IE - so this applies to you as well.

 

Hope this helps.

Posted: Wednesday, May 14, 2008 11:52 AM by gsherman

Comments

Gary Storey said:

I always have this option enabled.  What's interesting to me is how many script errors you can encounter in a single session of surfing the web. It is ridiculous how many people write bad Javascript code because they don't check for these kinds of errors.

# May 14, 2008 1:28 PM

gsherman said:

I know. Its crazy!

Lots of sites deserve the "Works On My Machine" logo.

(yea, if your machine swallows all exceptions)

# May 14, 2008 5:02 PM