【发布时间】:2015-07-08 11:48:28
【问题描述】:
在生产服务器上,我观察 JS 错误并发送到服务器:
<script type="text/javascript">
window.onerror=function(msg,url,line) {
if (window.XMLHttpRequest)
{
var xmlhttp = new XMLHttpRequest();
}
else
{
var xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.open('POST', '/logJSerrorsHere', true);
xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xmlhttp.send('msg='+encodeURIComponent(msg)+'&url='+encodeURIComponent(url)+'&line='+line);
return true;
}</script>
有时它会记录一些“神秘”的错误:“$ 未定义”,但它们都来自“googlebot(at)googlebot.com”或 spiderbot。我应该处理它吗?
【问题讨论】:
标签: javascript php ajax google-app-engine