How can i display a Blob with pdf content immediately a new tab or have it displayed inline using an iframe?
in chrome and FF i can use something like this
var url = URL.createObjectURL(blob);
$('#uplFrame').attr('src', url);
but does not work in IE...i read online that IE is using the following for handeling blobs
window.navigator.msSaveOrOpenBlob(blob, "filename");
however this will ask the user if he wants to save or open the file in a new window. is it possible to let the code open the blob this automatically?
or is there a similar solution for the "createObjectURL" that does work for IE?
For security reason and implementation the operation is not allowed in IE so the team build a specific API for asking permissions:
// Save the blob1 content to a file, giving just a "Save" option
window.navigator.msSaveBlob(blob1, 'msSaveBlob_testFile.txt');
// Save the blob2 content to a file, giving both "Save" *and* "Open" options
window.navigator.msSaveOrOpenBlob(blob2, 'msSaveBlobOrOpenBlob_testFile.txt');
Ref: https://msdn.microsoft.com/library/hh673542(v=vs.85).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With