window.onerror = handleError;
function handleError(msg, url, l) {
var txt = '发现错误.\n\n';
txt += '错误: ' + msg + '\n';
txt += '路径: ' + url + '\n';
txt += '行: ' + l + '\n\n';
alert(txt);
return true;
}
window.onerror = handleError;
function handleError(msg, url, l) {
var txt = '发现错误.\n\n';
txt += '错误: ' + msg + '\n';
txt += '路径: ' + url + '\n';
txt += '行: ' + l + '\n\n';
alert(txt);
return true;
}
本文标题:全局捕捉JS报错
本文链接:https://www.haomeiwen.com/subject/qjyvwhtx.html
网友评论