JavaScript全局错误处理 [英] JavaScript global error handling

查看:105
本文介绍了JavaScript全局错误处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想捕获每个未定义的函数错误抛出。 JavaScript中是否存在全局错误处理工具?用例是捕捉未定义的flash函数调用。

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.

推荐答案

这对你有帮助吗?

<script type="text/javascript">
window.onerror = function() {
    alert("Error caught");
};

xxx();
</script>

我不确定它如何处理Flash错误...

I'm not sure how it handles Flash errors though...

更新:它在Opera中不起作用,但我现在正在攻击Dragonfly以查看它的内容。关于黑客攻击蜻蜓的建议来自这个问题:

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:

模仿窗口。使用javascript 在Opera中出现错误

Mimic Window. onerror in Opera using javascript

这篇关于JavaScript全局错误处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆