在IE中显示iframe中的blob失败

时间:2013-12-03 23:59:27

标签: javascript jquery internet-explorer iframe blob

所以,要点是,我正在将上传的文件下载到数据库,以便在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,也没有显示任何内容,任何想法要解决它?

1 个答案:

答案 0 :(得分:1)

取决于您正在使用的内容类型,但由于它位于IFRAME,因此公平地认为IE不支持该内容类型的数据URI。 ref: caniuse

根据上述参考资料,IE支持图像,CSS和脚本文件,但不是 HTML。我可以根据个人经验验证HTML数据网址,例如

data:text/html, <h1>Hi</h1><p>I'm a data URL

在IE10中不起作用。