DOM:window.onerror
From MDC
Contents |
[edit] Summary
An event handler for error events sent to the window.
[edit] Syntax
window.onerror = funcRef;
[edit] Parameters
-
funcRefis a reference to a function. When the function returnstrue, this prevents the firing of the default event handler. Function parameters:- Error message (string)
- Url where error was raised (string)
- Error code (number)
[edit] Example
window.onerror = null;
[edit] Notes
The error event is raised when an error occurs in the script. The example above prevents error dialogs from displaying-which is the window's normal behavior-by overriding the default event handler for error events that go to the window.
When using the inline html markup (<body onerror="alert('an error occurred')>...), the arguments are not named. They can be referenced by arguments[0] through arguments[2].
[edit] Specification
Not part of specification.