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

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


当前回答

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

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

其他回答

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

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

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

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);

这解决了间歇性取消请求的问题。

如果你使用了一些基于可观察对象的HTTP请求,比如Angular(2+)中内置的那些请求,那么当可观察对象被取消时,HTTP请求也可以被取消(当你使用RxJS 6 switchMap操作符合并流时很常见的事情)。在大多数情况下,如果您想要完成请求,使用mergeMap操作符就足够了。

请求可能已经被跟踪保护插件阻止了。

当我在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中有什么变化。