| Programming C# C++ (7) Delphi (618) Java (8) JavaScript (30) Document (8) Events (8) ExtJS (8) Strings (3) perl (9) php (4) VBScript (1) Visual Basic (1) |
Catch javascript error messages before they pop up
Since version 1.1 client side Javascript has an event driven error handling model where you define a handler function for window.onerror to overwrite the error handling. The error handler has three arguments error message, url and line number. It should return true if the error is handled and return false to let the browser handle the error. The sample code below shows an easy-catch-all handler and an advanced one which actually looks into the passed error information and tries to do something reasonable. The advanced version also restores the browser's default handler when done.
Comments:
|