在IE中显示iframe中的blob失败 [英] Show blob in iframe fails in IE
问题描述
所以,要点是,我正在将上传的文件下载到数据库,以便在iframe中显示它们,至少大部分是
So, the gist is, I'm downloading uploaded files to the db to show them, at least most of them, inside a iframe
这是代码:
var ancho = $(window).width() * 0.90;
var alto = $(window).height() * 0.90;
$("#DialogoImagen").dialog({
show: {
effect: 'blind'
},
hide: {
effect: 'blind'
},
width: ancho,
height: alto,
resizable: true,
draggable: true,
title: '',
modal: true,
position: { my: "center", at: "top", of: window }
});
$("#DialogoImagen").children().remove();
var iframe = $("<iframe width='98%' src='" + window.URL.createObjectURL(archivo) + "'/>");
$("#DialogoImagen").append(iframe);
它没有其他世界,我设置 iframe
src
带有 window.URL.createObjectURL(blob)
,与Chrome,FF,Opera完美配合,但是,IE,即使是11,也没有显示任何内容,知道如何解决它?
Its nothing of the other world, I set the iframe
src
with a window.URL.createObjectURL(blob)
, works flawlessly with Chrome, FF, Opera, but, IE, even 11, is showing nothing, any idea what to do to solve it?
推荐答案
取决于什么类型的内容你正在使用,但由于它是在 IFRAME
,所以可以肯定的是,IE不支持该内容类型的数据URI。 ref:caniuse
Depends what type of content you're working with, but since it's going in an IFRAME
it's a fair bet that IE just doesn't support data URIs for that content type. ref: caniuse
根据以上内容参考,IE支持图像,CSS和脚本文件,但不是 HTML。我可以根据个人经验验证HTML数据网址,例如
According to the above reference, IE supports images, CSS and script files, but not HTML. I can verify from personal experience that HTML data URLs, e.g.
data:text/html, <h1>Hi</h1><p>I'm a data URL
在IE10中不起作用。
don't work in IE10.
这篇关于在IE中显示iframe中的blob失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!