NoraL Posted February 1, 2006 Share Posted February 1, 2006 I have the following code in my page:<script type="text/javascript">function handleError(message, URI, line) { window.location.replace("JavascriptError.htm?" + message + "," + URI + "," + line); return true;}window.onerror = handleError;</script>When my page encounters a syntax error, it fires the event fine. But when the page has what I consider to be a runtime error, it does not fire in IE 6. (It does seem to be firing in FireFox.)From all the documentation I have read, it says it should fire for all JavaScript errors. And I haven't found anyone else having this same problem.An example of an error that doesn't cause the event is as follows:Java Script ErrorDescription:A dynamic link library (DLL) initialization routine failed.And then the soure and line number are given.That's one example, but I can cause other JavaScript errors that aren't firing the code in IE 6.Is there something wrong in my code? Or has anyone else noticed this problem?Thanks,Nora Link to comment Share on other sites More sharing options...
aspnetguy Posted February 1, 2006 Share Posted February 1, 2006 change window.onerror = handleError; to document.onerror = handleError; Link to comment Share on other sites More sharing options...
NoraL Posted February 1, 2006 Author Share Posted February 1, 2006 I got the same results with document.onerror as I did with window.onerror. Link to comment Share on other sites More sharing options...
aspnetguy Posted February 1, 2006 Share Posted February 1, 2006 I have never had this problem before...I don't see what could be wrong with it...sorry. Link to comment Share on other sites More sharing options...
NoraL Posted February 1, 2006 Author Share Posted February 1, 2006 Thanks anyway. Link to comment Share on other sites More sharing options...
Err Posted February 1, 2006 Share Posted February 1, 2006 umm... maybe this? <script type="text/javascript">function handleError(URL, message, URI, line) {document.location.replace("JavascriptError.htm?" + message + "," + URI + "," + line);return true;}document.onerror = handleError;</script> Link to comment Share on other sites More sharing options...
NoraL Posted February 1, 2006 Author Share Posted February 1, 2006 This didn't work either. Actually the document.onerror in both cases didn't even get fired for syntax errors when the window.onerror did fire for syntax problems, just not for runtime errors. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now