本文介绍了图像无法在带有 DOM 的 IE 中加载:控制台中的 7009 错误(无法解码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

在IE单页加载多张图片时(IE11转载),部分图片开始加载失败,控制台出现类似如下警告:

When loading many images on a single page in IE (reproduced in IE11), some of them begin to fail to load, and have something similar to the following warning in the console:

DOM7009:无法在 URL 处解码图像:'[some unique url]'.

当我查看网络流量时,似乎确实从服务器收到了对这些图像中的每一个的有效响应.每次并不总是相同的图像.如果我使用开发工具强制重新加载图像(例如:我更新 url 以包含一些无关的 url 参数&test=1"),它会正常加载/呈现而不会出错.我已经用不同类型的图像(jpegs/pngs;下面包含的示例 png)重现了这种行为.随着图像数量的增加,这种情况似乎发生得更频繁,并且也可能与每个图像的大小有一定的相关性.

When I look at the network traffic, there does appear to valid responses received for each of these images from the server. It's not always the same images each time. If I use the dev tools to force the image to reload (example: I update the url to include some some extraneous url parameter "&test=1"), it loads/renders normally without error. I've reproduced this behavior with different types of images (jpegs/pngs; example png included below). It seems to happen more frequently as the number of images go up, and may also have some correlation with the size of each image.

对可能导致这种情况的原因有任何想法吗?潜在的解决方法?任何帮助表示赞赏.

Any thoughts as to what might be causing this? Potential work-arounds? Any help is appreciated.

推荐答案

看起来实际问题已在 另一个 Stack Overflow 问题中解决.这里的所有答案都以各种方式解决了这个问题,但这很可能发生,因为文件不是它声称的格式.因为 nosniff 已启用,浏览器无法解决此问题,并尝试解码错误的图像类型.

It looks like the actual problem is addressed in another Stack Overflow question. All of the answers here get around the issue in various ways, but this is likely happening because the file is not the format it claims to be. Because nosniff is enabled, the browser is unable to work around this issue, and attempts to decode the wrong image type.

换句话说:您的文件扩展名与实际编码不匹配

In other words: Your file extension does not match the actual encoding

这篇关于图像无法在带有 DOM 的 IE 中加载:控制台中的 7009 错误(无法解码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 15:27