检测网站的JS报错
window.onerror = function (errorMessage, scriptURI, lineNumber, columnNumber, errorObj) { var context = "错误路径:" + window.location.href + ";\n" + "错误信息:" + errorMessage + ";\n" + "出错文件:" + scriptURI + ";\n" + "出错行号:" + lineNumber + ";\n" + "出错列号:" + columnNumber + ";\n" + "错误详情:" + errorObj + "。\n"; //获取到错误之后上传。 }