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

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


当前回答

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

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

其他回答

对我来说,这是一条错误的道路。我建议调试的第一步是看看你是否可以加载文件独立的ajax等。

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

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

当我通过JavaScript重定向时,我在Chrome中得到了这个错误:

<script>
    window.location.href = "devhost:88/somepage";
</script>

如你所见,我忘记了'http://'.在我添加它之后,它起作用了。

当我在iframe内的单独域上的安全页面和非安全页面之间重定向时,发生了一个取消的请求。重定向请求在开发工具中显示为“已取消”请求。

我有一个iframe页面,其中包含一个由我的支付网关托管的表单。当iframe中的表单被提交时,支付网关将重定向回我服务器上的URL。重定向最近停止工作,并以“取消”请求结束。

似乎Chrome(我使用的是Windows 7 Chrome 30.0.1599.101)不再允许在iframe内重定向到一个单独域上的非安全页面。为了解决这个问题,我只是确保iframe中的任何重定向请求总是发送到安全url。

当我用一个iframe创建一个更简单的测试页面时,在控制台中有一个警告(我之前错过了或可能没有显示):

[Blocked] The page at https://mydomain.com/Payment/EnterDetails ran insecure content from http://mydomain.com/Payment/Success

在PC、Mac和Android上的Chrome浏览器中,重定向变成了被取消的请求。我不知道这是否是特定于我的网站设置(SagePay Low Profile)或如果Chrome中有什么变化。

从严格的Angular角度来看:

当你不能在代码层面上正确地中断时,就会发生这种情况。

假设request1出来了,它的响应也是, 在那之后,嵌套的request2也出去了,它的响应也来了,我们直接打破了循环,没有正确地破坏request1的订阅,

在那个时候,它发生了