0
即时通讯建立一个应用程序,使用长轮询技术和即时通讯运行IE8的一些麻烦。长时间轮询问题与IE8
所以这里是简化的代码,我使用:
PHP:
$time = time();
while((time() - $time) < 10) {
$data = rand(0,10);
// if we have new data return it
if($data == 3 || $data == 6) {
echo json_encode($data);
break;
}
sleep(1);
}
JS:
var lpOnComplete = function(response) {
alert(response);
// do more processing
lpStart();
};
var lpStart = function() {
$.post('http://example.com/test', {}, lpOnComplete, 'json');
};
$(document).ready(lpStart);
的问题似乎是,IE8不会等待直到服务器响应但会在第一个正确响应后直接触发下一个请求或死亡。 什么可能导致此行为?