什么会导致页面被取消?我有一个Chrome开发者工具的截图。

这种情况经常发生,但不是每次都发生。似乎一旦缓存了一些其他资源,页面刷新就会加载LeftPane.aspx。真正奇怪的是,这只发生在谷歌Chrome浏览器中,而不是ie8。知道为什么Chrome会取消一个请求吗?


当前回答

在我的案例中,显示电子邮件客户端窗口的代码导致Chrome停止加载图像:

document.location.href = mailToLink;

移动到$(window)。负载(功能 () {...}) 而不是美元(函数 () {...}) 帮助。

其他回答

我们遇到(取消)状态的另一个地方是在特定的TLS证书错误配置中。如果一个网站(例如https://www.example.com)配置错误,导致证书不包括www。但有效的https://example.com, chrome将取消此请求,并自动重定向到后者的网站。Firefox则不是这样。

当前有效的示例:https://www.pthree.org/

这是发生在我身上的事情:服务器为302重定向返回了一个格式错误的“Location”头。 当然,Chrome没有告诉我这一点。我在firefox中打开了这个页面,并立即发现了问题。 有多种工具真好:)

Chrome版本33.0.1750.154米一致取消图像加载,如果我使用移动仿真指向我的本地主机;特别是用户代理欺骗(相对于屏幕设置)。

当我关闭用户代理欺骗时;图像请求没有被取消,我看到了图像。

我仍然不明白为什么;在前一种情况下,当请求被取消时,请求头(注意:显示的是临时头)只有

接受 cache - control 编译指示 推荐人 用户代理

在后一种情况下,所有这些因素加上其他因素,比如:

饼干 连接 宿主 接受编码 接收语言

耸耸肩

我也遇到过同样的问题,在我们的代码深处,我们有这样的伪代码:

创建iframe 加载iframe提交一个表单 2秒后,移除iframe

thus, when the server takes more than 2 seconds to respond the iframe to which the server was writing the response to, was removed, but the response was still to be written , but there was no iframe to write , thus chrome cancelled the request, thus to avoid this I made sure that the iframe is removed only after the response is over, or you can change the target to "_blank". Thus one of the reason is: when the resource(iframe in my case) that you are writing something in, is removed or deleted before you stop writing to it, the request will be cancelled

注意:确保你没有任何包装表单元素。

我有一个类似的问题,我的按钮onclick={}被包装在一个表单元素。当点击按钮时,表单也被提交了,这把事情搞砸了……