当我在我们的生产系统上执行 XHR 时,响应中的 statusText 将是一个空字符串.但是,在我们的开发系统中,statusText 会正确反映状态.
When I perform an XHR on our production system, the statusText in the response will be an empty string. However, on our development system, the statusText will reflect the status correctly.
根据 XMLHttpRequest.statusText<的文档/code>,它只能在处理请求时为空.但是,我在 onload 处理程序中看到了这种行为.
According to the documentation for XMLHttpRequest.statusText, it should only be empty while the request is being processed. However, I am seeing this behavior in the onload handler.
此外,这种行为只能在 Chrome 和 Edge 中观察到.Firefox 将显示正确的文本.
Additionally, this behavior can only be observed in Chrome and Edge. Firefox will display the correct text.
那么,statusText的内容究竟是如何确定的呢?
So, how is the content of the statusText actually determined?
可能是因为一台服务器使用 HTTP/2,而另一台没有.HTTP/2 不再有原因短语.
It might be because one server uses HTTP/2, while the other does not. HTTP/2 doesn't have reason phrases anymore.
这篇关于为什么我的 XHR 的 statusText 是空的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
即使在调用 abort (jQuery) 之后,浏览器也会等待Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在调用 abort (jQuery) 之后,浏览器也会等待 ajax 调用
JavaScript innerHTML 不适用于 IE?JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不适用于 IE?)
XMLHttpRequest 无法加载,请求的资源上不存在“AXMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 无法加载,请求的资
XHR HEAD 请求是否有可能不遵循重定向 (301 302)Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 请求是否有可能不遵循重定向 (301 302))
NETWORK_ERROR:XMLHttpRequest 异常 101NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 异常 101)
XMLHttpRequest 206 部分内容XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分内容)