REQUEST A DEMO

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 JavaScript:

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):

Double-clicking the icon will give you more 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.

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

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

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

Hope this helps.