什么会导致页面被取消?我有一个Chrome开发者工具的截图。
这种情况经常发生,但不是每次都发生。似乎一旦缓存了一些其他资源,页面刷新就会加载LeftPane.aspx。真正奇怪的是,这只发生在谷歌Chrome浏览器中,而不是ie8。知道为什么Chrome会取消一个请求吗?
什么会导致页面被取消?我有一个Chrome开发者工具的截图。
这种情况经常发生,但不是每次都发生。似乎一旦缓存了一些其他资源,页面刷新就会加载LeftPane.aspx。真正奇怪的是,这只发生在谷歌Chrome浏览器中,而不是ie8。知道为什么Chrome会取消一个请求吗?
当前回答
请求可能已经被跟踪保护插件阻止了。
其他回答
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);
这解决了间歇性取消请求的问题。
对我来说,这是一条错误的道路。我建议调试的第一步是看看你是否可以加载文件独立的ajax等。
我在div标签里面有一个a标签。div有onclick="location='http://mydestination.org/'"和一个标签在href中有相同的URL。这导致目标页面被加载两次,第一次加载被Chrome取消。
注意:确保你没有任何包装表单元素。
我有一个类似的问题,我的按钮onclick={}被包装在一个表单元素。当点击按钮时,表单也被提交了,这把事情搞砸了……
我也遇到过同样的问题,在我们的代码深处,我们有这样的伪代码:
创建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