Here is an example of using the onerror event:
Now if we make an obvious error like the following…
we’ll get a nice detailed error message.
This works in Firefox 3 and IE 7. For some reason this doesn’t work in Chrome (v184.108.40.206). If you can shed some light on why this doesn’t work in Chrome please do so in the comments section below.
Keep in mind that you shouldn’t deploy this type of error handling into a production server – you might think about using a compiler directive so that the code only exists in Debug mode.