내 시스템에서 긴 폴링을 푸시 메커니즘으로 사용하고 있습니다. Chrome에서는 & Chrome에서 정상적으로 작동하지만 IE8에서는 동작이 매우 이상합니다. 5 회 (즉, 새로 고침 (F5)) 페이지를 5 번로드 할 수 있으며 HTML이로드되고 모든 스크립트가 실행 중입니다. 정확하게) IE8은 수행하고 네트워크 연결을 거부하고 (Fiddler2로 확인한) 단순히 "로드 중"아이콘을 무한히 보여줍니다. 이 단계의 유일한 치료법은 브라우저를 닫고 열어 보는 것입니다.
저는 JQuery와 PHP를 사용하고 있습니다. 나는 다른 포럼에서 답을 찾을 수 있었다 긴 검색 후IE8은 5 번의 긴 폴링 요청 후 네트워크 액세스를 중지합니다.
setTimeout(function() // called from $(function(){}), jquery page ready event
{
start_polling();
},1000);
function start_polling()
{
$.ajax(
{
url: "/push",
// must avoid cache because sometimes user is logged in and sometimes not
data:
{
"anticache":Math.random()
},
type: "post",
timeout: 30000, // half a minute before each restart long polling
success: function(data)
{
var dataObj = eval("("+data+")");
{
create_notif("withIcon",
{
title: dataObj.title,
text: dataObj.text,
icon: "/img/"+dataObj.type+".png"
},
{
click: function(e, instance)
{
instance.close();
}
});
}
start_polling();
},// end success of ajax load
error: function(x,t,m)
{
if(t==="timeout") {
//alert("got timeout");
start_polling();
} else {
//alert(t);
}
//start_polling();
}
}) // end ajax
} // start polling
갱신 : 그것은하지만 지금까지 완벽한에서, 향상되었습니다. 어쩌면 모든 "아약스"요청을 수집하고 자동으로 "중단"을 적용하는 일종의 플러그인이 있어야할까요? –