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