AJAX (XmlHttpRequest) timeout length by browser(浏览器的 AJAX (XmlHttpRequest) 超时长度)
问题描述
我一直在网上搜索,试图找到一个直接的答案.有谁知道浏览器 ajax 请求的默认超时长度?如果它改变了,也按版本?
I've been scouring the web trying to find a straight answer to this. Does anyone know the default timeout lengths for ajax request by browser? Also by version if it's changed?
推荐答案
我认为浏览器没有AJAX超时,只有同步或异步请求;同步 - 首先冻结 JavaScript 执行,直到请求返回,异步 - 不冻结 JavaScript 执行,它只是将请求从执行流程中取出,如果您有回调函数,它将与正在运行的脚本并行执行该函数(类似于线程)
I don't think browsers have a timeout for AJAX, there is only synchronous or asynchronous requests; synchronous - first freezes the JavaScript execution until the request returns, asynchronous - does not freeze JavaScript execution, it simply takes the request out of the execution flow, and if you have a callback function it will execute the the function in parallel with the running scripts (similar to a thread)
**sync flow:**
running JS script
|
ajax
(wait for response)
|
execute callback
|
running JS script
**async flow:**
running JS script
|
ajax --------------------
| |
running JS script execute callback
这篇关于浏览器的 AJAX (XmlHttpRequest) 超时长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:浏览器的 AJAX (XmlHttpRequest) 超时长度


基础教程推荐
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01