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

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


当前回答

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

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

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

其他回答

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

以我为例,我发现它是jquery的全局超时设置,一个jquery插件设置全局超时为500ms,这样当请求超过500ms时,chrome就会取消请求。

我在加载300张图片作为背景图片时遇到了这种情况。我猜一旦第一个超时,它就会取消所有其他的,或者达到最大并发请求。需要一次实现5个

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

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

其中一个原因可能是XMLHttpRequest.abort()在代码中某处被调用,在这种情况下,请求将在Chrome开发工具网络选项卡中具有取消状态。