页面错误提示

window.onerror = function (errMsg, scriptURI, lineNumber, columnNumber, errorObj) {
    setTimeout(function () {
        var rst = {
            "错误信息:": errMsg,
            "出错文件:": scriptURI,
            "出错行号:": lineNumber,
            "出错列号:": columnNumber,
            "错误详情:": errorObj
        };

        alert('出错了,下一步将显示错误信息');
        alert(JSON.stringify(rst, null, 10));
    });
};

 

转载于:https://www.cnblogs.com/doseoer/p/6104678.html

你可能感兴趣的:(页面错误提示)