我正在编写一个 AJAX 网络应用程序,它使用 Comet/Long Polling 来保持网页最新,我注意到在 Chrome 中,它将页面视为一直在加载(选项卡的图标一直在旋转)。
我认为这对于 Google Chrome + Ajax 来说是正常的,因为即使是 Google Wave 也有这种行为。
那么今天我注意到 Google Wave 不再保持加载图标旋转,有人知道他们是如何解决这个问题的吗?
这是我的ajax调用代码
var xmlHttpReq = false;
// Mozilla/Safari
if (window.XMLHttpRequest) {
xmlHttpReq = new XMLHttpRequest();
}
// IE
else if (window.ActiveXObject) {
xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttpReq.open('GET', myURL, true);
xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttpReq.onreadystatechange = function() {
if (xmlHttpReq.readyState == 4) {
updatePage(xmlHttpReq.responseText);
}
}
xmlHttpReq.send(null);