Javascript Global Error Handling (not Work On Ie 9)
Solution 1:
From: http://msdn.microsoft.com/en-us/library/ms976144.aspx
Handling Errors via the window.onerror DHTML Event
A common problem that bites many developers occurs when their onerror handler is not called because they have script debugging enabled for Internet Explorer. This will be the case by default if you have installed the Microsoft Script Debugger or Microsoft Visual Studio 6.0® (specifically Visual InterDev 6.0™)—onerror handling is how these products launch their debugger. You can disable script debugging for a given instance of Internet Explorer on the Advanced tab of the Internet Options dialog box (note that checking the Disable script debugging setting will apply only to that instance of Internet Explorer)
Disable script debugging to invoke your own onerror handler
It should be clear from this discussion that you can catch both syntax and run-time errors using a window.onerror handler. However, I only told you this so that you would understand how it works, not so that you would intentionally allow syntax errors in your production Web pages. All syntax errors can, and should, be eliminated during the development phase. Besides, onerror handling doesn't even work for VBScript syntax errors (as noted below), and there is no way to catch server-side syntax errors in any language.
Disable script debugging on IE
- In Internet Explorer, choose Internet Options from the Tools menu.
- In the Internet Options dialog box, click the Advanced tab.
- On the Advanced tab, under Browsing, clear Disable Script Debugging.
- Click OK.
Post a Comment for "Javascript Global Error Handling (not Work On Ie 9)"