更新时间:2021-09-28 22:10:54
由于他们是客户端错误,您必须将它们发送到服务器使用XMLHttpRequest。您可以使用 try ... catch
语句或 window.onerror
:
Since they're client-side errors, you'll have to send them to the server using XMLHttpRequest. You could use try...catch
statements or window.onerror
:
window.onerror = function (msg, url, line)
{
var message = "Error in "+url+" on line "+line+": "+msg;
$.post("logerror.aspx", { "msg" : message });
}
注意行
和 url
可能在8之前的IE版本中非常不准确。
Be aware that line
and url
can be very inaccurate in IE versions prior to 8.