Show blob in iframe fails in IE

时光总嘲笑我的痴心妄想 提交于 2019-12-10 23:49:24

问题


So, the gist is, I'm downloading uploaded files to the db to show them, at least most of them, inside a iframe

This is the code:

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);

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?


回答1:


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

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

don't work in IE10.



来源:https://stackoverflow.com/questions/20364237/show-blob-in-iframe-fails-in-ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!