admin管理员组文章数量:1220142
For automated testing reasons I want to detect if the browser has encountered JavaScript errors for a page. The type of things that would cause the red numbers in the bottom right in Firebug or yellow warning icon in the Internet Explorer status bar. These JS errors could come from any one of a large numbers of scripts.
How in JavaScript can I detect these browser errors? Cross browser solutions prefered, but hey, I'll take anything!
As a bonus it would also be great to know the script that caused the error.
For automated testing reasons I want to detect if the browser has encountered JavaScript errors for a page. The type of things that would cause the red numbers in the bottom right in Firebug or yellow warning icon in the Internet Explorer status bar. These JS errors could come from any one of a large numbers of scripts.
How in JavaScript can I detect these browser errors? Cross browser solutions prefered, but hey, I'll take anything!
As a bonus it would also be great to know the script that caused the error.
Share Improve this question asked Apr 2, 2010 at 20:27 RichHRichH 6,1382 gold badges39 silver badges62 bronze badges1 Answer
Reset to default 18window.onerror handler is the answer. Read this - http://www.javascriptkit.com/javatutors/error.shtml
To get more information about the script that caused the error, read this - http://www.javascriptkit.com/javatutors/error3.shtml
本文标签: How can I detect if the browser has encountered a JavaScript errorin JavaScriptStack Overflow
版权声明:本文标题:How can I detect if the browser has encountered a JavaScript error ... in JavaScript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739336020a2158709.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论