当窗口关闭或刷新速度太快时,例如在stackoverflow投票调用中,ajax调用如何终止? [英] How does ajax call terminate when window closed or refreshed too fast as example at stackoverflow voting calls?

查看:94
本文介绍了当窗口关闭或刷新速度太快时,例如在stackoverflow投票调用中,ajax调用如何终止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我在这个元问题中所问的那样: https://meta.stackexchange.com/questions/119259/voting-is-lost-due-to-ajax-call-latency

As I asked in this meta question: https://meta.stackexchange.com/questions/119259/voting-is-lost-due-to-ajax-call-latency

我想知道问题如何发生?

I wonder about issue, how it occurs?

是因为浏览器发送了一条通知,提示说I gave up
是因为浏览器甚至无法发送xhr请求,这实际上是用户的一项快速动作?

Is it because browser sends a notification that it says I gave upor
is it because it is really fast action by user that browser even could not send the xhr request?

推荐答案

我猜想发送了请求 ,但是当出现以下情况时,浏览器取消 XHR待处理请求页面已卸载.

I'd guess that the request is sent, but that browsers cancel XHR pending requests when a page is unloaded.

XHR请求可以通过.abort()方法手动取消,因此,如果挂起的请求被中止,这也不会令我感到惊讶.

XHR requests can be canceled manually via the .abort() method, so it wouldn't surprise me if pending requests are aborted.

这篇关于当窗口关闭或刷新速度太快时,例如在stackoverflow投票调用中,ajax调用如何终止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆