什么会导致页面被取消?我有一个Chrome开发者工具的截图。
这种情况经常发生,但不是每次都发生。似乎一旦缓存了一些其他资源,页面刷新就会加载LeftPane.aspx。真正奇怪的是,这只发生在谷歌Chrome浏览器中,而不是ie8。知道为什么Chrome会取消一个请求吗?
什么会导致页面被取消?我有一个Chrome开发者工具的截图。
这种情况经常发生,但不是每次都发生。似乎一旦缓存了一些其他资源,页面刷新就会加载LeftPane.aspx。真正奇怪的是,这只发生在谷歌Chrome浏览器中,而不是ie8。知道为什么Chrome会取消一个请求吗?
当前回答
这是chrome取消请求的另一个例子,我刚刚遇到过,上面的答案中没有提到。
简单地说 我的android手机上的自签名证书不受信任。
细节 我们正处于开发/调试阶段。url指向自签名主机。代码是这样的:
location.href = 'https://some.host.com/some/path'
Chrome只是默默地取消了请求,没有给像我这样的web开发新手留下任何线索来解决这个问题。一旦我使用android手机下载并安装了证书,问题就消失了。
其他回答
对我来说,“取消”状态是因为文件不存在。奇怪为什么chrome浏览器不显示404。
我也遇到过同样的问题,在我们的代码深处,我们有这样的伪代码:
创建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
在我的情况下,问题的原因是另一个。
我的应用程序坐在代理后面,Chrome请求被发送与If-Modified-Since HTTP头。当这个头文件出现时,预期的行为是:
只有在给定日期后最后一次修改时,服务器才会以200状态发送回所请求的资源。如果请求此后未被修改,则响应将是一个没有任何正文的304;
代理没有满足这一期望,响应一个304状态代码,但一个非空的主体,从而导致请求被取消。
在修复代理行为后,请求就像一个魅力。
I had the same issue when updating a record. Inside the save() i was prepping the rawdata taken from the form to match the database format (doing a lot of mapping of enums values, etc), and this intermittently cancels the put request. i resolved it by taking out the data prepping from the save() and creating a dedicated dataPrep() method out of it. I turned this dataPrep into async and await all the memory intensive data conversion. I then return the prepped data to the save() method that i could use in the http put client. I made sure i await on dataPrep() before calling the put method:
等待dataToUpdate =等待dataPrep(); http。把(apiUrl dataToUpdate);
这解决了间歇性取消请求的问题。
当我在样式表中嵌入web字体时,我已经嵌入了所有类型的字体以及woff, woff2, ttf。最近我注意到Chrome取消请求ttf和woff时,woff2是存在的。我现在使用Chrome版本66.0.3359.181,但我不确定Chrome什么时候开始取消额外的字体类型。