Skip to content Skip to sidebar Skip to footer

Ie How To Open Blob Object In New Tab

Hi any one have idea about how to open an blob object in IE new Tab var blob = base64toBlob(blobresponse); if (blob) { if (window.navigator && wind

Solution 1:

As far I know, IE has a problem with opening blob URL in new tab. But you can force it to download.

window.navigator.msSaveOrOpenBlob(blob , 'test.pdf');

But if you want to view PDF in IE, you can try to use pdf.js (link)

Solution 2:

you can do it using iframe

var blob = base64toBlob(blobresponse);

if (blob) {
    var tab = window.open();
    var objectUrl = URL.createObjectURL(blob);
    if (window.navigator &&
        window.navigator.msSaveOrOpenBlob) { // for IEvar iframe= document.createElement("iframe");
        tab.document.body.appendChild(iframe);  
        iframe.src = objectUrl;
        iframe.setAttribute("style","width:100%;height:100%");                      
    } else { // for Chrome           
        tab.location.href = objectUrl;
    }
}

Post a Comment for "Ie How To Open Blob Object In New Tab"