同时发出多个 XHR 请求
我有一个关于异步请求调用的基本问题。 浏览器是否同时执行多个 XHR,或者如果发送新请求而第一个请求仍在工作,浏览器是否会中止请求?浏览器之间的实现有差异吗?
我尝试在循环中创建一堆请求,但除了最后一个之外,所有请求都被中止。所以现在我计划为所有请求实现一个队列,但我不确定这是否真的需要。
问候
I have a basic question about asynchronous request call.
Does the browser execute more than one XHR at the same time, or does it abort a request if a new one is send, while the first is still working? Are there differences in the implementation between browsers?
I tried to create a hole bunch of requests in a loop, but all, except the last one, were aborted. So for now i plan to implement a queue for all requests, but i am not certain if this is really needed.
Greetings
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,浏览器确实允许多个并发 XHR。
如果您的代码仅成功一个,则很可能是因为存在错误。如果可能的话,创建一个小例子并向我们展示您在做什么。
Yes, browsers do allow multiple concurrent XHR.
If your code only succeeds with one, it's most probably because of a bug. If possible, create a small example and show us what you are doing.