开发者

What happens to my ajax request after window unload

what happens to my syn/asyn XMLHttpRequest (IE) when the page unload but the request is still on his way?

Is it meaningful to bind to the $(window).unload and call the .abort() method for my request object?

The problem is that in some cases th开发者_运维百科e page loads and unloads very fast and in some cases the good old IE 6 freezes for at least 3 min.

Daniel


There is a known bug in IE where inflight XHR requests are not properly cleaned up when you leave a page. The workaround is to set up an 'unload' event handler that aborts any in-progress requests.

Some related commentary:

  • http://www.sencha.com/forum/archive/index.php/t-90632.html
  • ie save onunload bug


I don't know for other browsers but in IE you can't make async $.post in window.unload.

Set async param to false in the $.ajax()/$.post and it will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜