当XMLHttpRequest处于“pending”状态时;状态(在Chrome中)是否将该时间计入它的超时时间

When an XMLHttpRequest is in "pending" state (in Chrome) does that time count towards it's timeout duration?

本文关键字:状态 时间 是否 超时 Chrome pending 处于 XMLHttpRequest      更新时间:2023-09-26

如果我发出100个xmlhttprequest请求,超时时间为1秒,服务器需要1秒才能响应,大多数请求会超时吗?

我用下面的代码(https://gist.github.com/anonymous/ba0fc7967829d7d0841d)运行了一个测试,结果是肯定的——当一个请求处于挂起状态时,它会计入XHR的超时时间。

这意味着如果你想在服务器连接缓慢的情况下超时,你需要自己设置。