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

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


当前回答

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

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

其他回答

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

创建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

如果您使用axios,它可以帮助您

// change timeout delay: Instance.defaults.timeout = 2500;

https://github.com/axios/axios#config-order-of-precedence

对于任何来自LoopbackJS并试图使用图表示例中提供的自定义流方法的人。我使用PersistedModel得到这个错误,切换到基本模型修复了我的事件源状态取消的问题。

同样,这是专门针对环回api的。既然这是谷歌上的顶级答案,我想我应该把这个放在混合答案中。

在我的情况下,它开始出现后chrome 76更新。

由于一些问题在我的JS代码,窗口。位置被多次更新,导致取消先前的请求。 虽然这个问题之前就存在,但chrome在更新到版本76后开始取消请求。

这是chrome取消请求的另一个例子,我刚刚遇到过,上面的答案中没有提到。

简单地说 我的android手机上的自签名证书不受信任。

细节 我们正处于开发/调试阶段。url指向自签名主机。代码是这样的:

location.href = 'https://some.host.com/some/path'

Chrome只是默默地取消了请求,没有给像我这样的web开发新手留下任何线索来解决这个问题。一旦我使用android手机下载并安装了证书,问题就消失了。