javascript IE 上没有图像,只有带有白色 x 的黑框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19942789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 17:18:24  来源:igfitidea点击:

No images on IE only black box with white x

javascriptjqueryhtmlinternet-explorerflexslider

提问by tainterr

I have multiple flex sliders loading on this page: http://pamelahnelson.com/category/public-art/Normally if you click the white 'x', they show, but I have it triggering an event to slide open the detail view. Regardless, I think it is a security setting in the browser or similar that is blocking them, but what I really want to know is why this is being triggered? And of course, if there is a work around so that IE doesn't do this. I've used multiple flex sliders before without this problem.

我在这个页面上加载了多个 flex 滑块:http: //pamelahnelson.com/category/public-art/通常如果你点击白色的“x”,它们会显示,但我让它触发一个事件来滑动打开详细信息视图. 无论如何,我认为是浏览器中的安全设置或类似设置阻止了它们,但我真正想知道的是为什么会触发这种情况?当然,如果有一个变通办法让 IE 不这样做。我之前使用过多个 flex 滑块没有这个问题。

采纳答案by jk.

It appears that IE is aborting the image load: enter image description here

似乎 IE 正在中止图像加载: enter image description here

This could be because the script is trying modify an element before it's fully loaded.

这可能是因为脚本在完全加载之前尝试修改元素。

There is quite a bit of jsgoing on in your site so look into whatever script is writing the image files to the DOM.

js您的站点中有很多事情要做,因此请查看将图像文件写入 DOM 的任何脚本。

There is also a couple of errors in the console:

控制台中还有几个错误:

event.returnValue is deprecated. Please use the standard event.preventDefault() instead. jquery.js?ver=1.10.2:4

event.returnValue is deprecated. Please use the standard event.preventDefault() instead. jquery.js?ver=1.10.2:4

cannot call methods on isotope prior to initialization; attempted to call method 'reLayout'

cannot call methods on isotope prior to initialization; attempted to call method 'reLayout'

I would start with fixing the console errors since those cause IE quite a bit of heartburn.

我会从修复控制台错误开始,因为这些错误会导致 IE 相当多的胃灼热。

回答by Vanquished Wombat

In 2018 this could be related to the X-Content-type: nosniff header being emitted by the web server. This tells the browser to pay attention to the mime type (content-type header) in the image data response from the server. If it is not image/* then IE11 will decide it is dodgy and show the black-box with white-cross. Use Fiddler or similar to observe the headers from the server to confirm.

在 2018 年,这可能与 Web 服务器发出的 X-Content-type: nosniff 标头有关。这告诉浏览器注意来自服务器的图像数据响应中的 MIME 类型(内容类型标头)。如果它不是 image/* 则 IE11 会认为它是狡猾的并显示带有白十字的黑框。使用 Fiddler 或类似工具观察来自服务器的 headers 以确认。

回答by mellowd3

This is a bit older post but I just had this issue and it was fixed by re-saving my images to ensure the encoding was RGB, not CMYK. IE8-IE10 don't display CMYK images.

这是一个有点旧的帖子,但我刚刚遇到了这个问题,它通过重新保存我的图像以确保编码是 RGB 而不是 CMYK 来解决。IE8-IE10 不显示 CMYK 图像。