谷歌浏览器开发者工具中网络栏status=canceled 取消状态

时间:2022-08-23 05:06:33

在爆栈网(*)上找到了一个解释:
导致这一现象的原因可能是下面三个:

1.The DOM element that caused the request to be made got deleted (i.e. an IMG is being loaded, but before the load happened, you deleted the IMG node)

2.You did something that made loading the data unnecessary. (i.e. you started loading a iframe, then changed the src or overwrite the contents)

3.There are lots of requests going to the same server, and a network problem on earlier requests showed that subsequent requests weren’t going to work (DNS lookup error, earlier (same) request resulted e.g. HTTP 400 error code, etc)

意思既是:
1. DOM 元素还在请求网络的时候就被删除了;(比如图片在加载的过程中)
2. 你做了一些操作使加载变得不必要的;(如你改变了正在加载的iframe 的src);
3. 有许多请求一起请求相同的服务器,但是一个较早前报错的请求出现了,使得随后的请求不会正常起作用。

但是我的问题不在其中,我是通过(jquery)监听元素的点击事件,然后给它一个回调函数,并在该函数中添加

event.preventDefault()

解决的。真正的原因不得而知…