谷歌浏览器加载前端资源status=canceled
如图,今天在做弹出框(modal中用了iframe)的时候,发现模态框弹出的时候,会有一些前端资源加载被取消,但是也会有加载时间,影响页面的加载速度;然后我尝试用火狐,发现没有这个问题
经过一顿google,发现了出现canceled的原因
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、加载的资源在加载的过程中被删除了,显然我不是这种情况;
2、你做了一些不必要的操作(其实就是我这种情况,我在弹窗外已经引用了js,css,然后在iframe中又引入了一次,这就重复了);
3、多次请求同一个服务器地址,如果前一个请求出错,后续的请求会自动取消;
于是我把iframe中的重复引入的资源注释调,bingo