Created
November 3, 2014 11:00
-
-
Save shenqihui/206c7ca9f789a7b12c1b to your computer and use it in GitHub Desktop.
window.onerror 监控。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 监控网页错误情况 | |
//接受三个参数,分别是错误信息,错误页面的url和错误行号 | |
window.onerror = function(errorMessage, scriptURI, lineNumber,columnNumber,errorObj) { | |
console.log(arguments); | |
window.a = arguments; | |
var message = "错误信息: " + errorMessage + | |
" \n出错文件: " + scriptURI + | |
"\n出错行号: " + lineNumber + | |
" \n出错列号:" + columnNumber + | |
" \n错误详情:" + errorObj.message; | |
console.log(message); | |
// alert(message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment