Skip to content

Instantly share code, notes, and snippets.

@shenqihui
Created November 3, 2014 11:00
Show Gist options
  • Save shenqihui/206c7ca9f789a7b12c1b to your computer and use it in GitHub Desktop.
Save shenqihui/206c7ca9f789a7b12c1b to your computer and use it in GitHub Desktop.
window.onerror 监控。
// 监控网页错误情况
//接受三个参数,分别是错误信息,错误页面的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