Open Links Made by Createobjecturl in Ie11

URL.createObjectURL(blob) not creating proper URL in IE 11

IE does not create a url for these blob objects because of security reasons i think.So using var objectUrl = URL.createObjectURL(blob);will not give you the source url which you can use inside iframe or embed tag.
I faced the same issue and searched a lot about the fix.But could not get the answer.Instead i solved it as following.
you can use the following for IE

if (bowser.msie && window.navigator.msSaveOrOpenBlob) {
navigator.msSaveOrOpenBlob(file, fileName);
}else{
//do what you were doing for other than IE
}

the above IE code will prompt the user that whether he wants to save the file or directly open it.
User can click on button 'open' and then IE will show the PDF without downloading it in default reader.

Need to open blob/PDF in IE window

The reason why it works in Chrome and other normal browsers: they have pdf previewer installed inside of them.

The lease why it does not work in IE: since in architecture if IE there should be some PDF reading program installed on operating system; for instance, if you have Adobe Acrobat installed, you will open it without problems.

I can recommend you to use: pdf.js/.



Related Topics



Leave a reply



Submit