I would like to catch every undefined function error thrown. Is there a global error handling facility in Javascript? The use case is catching function calls from flash that are not defined.
+3
A:
Does this help you:
<script type="text/javascript">
window.onerror = function() {
alert("Error caught");
};
xxx();
</script>
I'm not sure how it handles Flash errors though...
Update: it doesn't work in Opera, but I'm hacking Dragonfly right now to see what it gets. Suggestion about hacking Dragonfly came from this question:
http://stackoverflow.com/questions/645840/mimic-window-onerror-in-opera-using-javascript
Ionuț G. Stan
2009-06-04 16:57:58
With the addition of msg, file_loc, line_no params this should do it for me. Thanks!
2009-06-04 17:16:21
I have just released code to help log JavaScript errors by sending error information to the server - http://www.thecodepage.com/post/JavaScript-Error-Notifications.aspx
Gabriel McAdams
2010-02-02 19:26:46