I have adopted various approaches to embed PDF blob in html in IE in order to display it.
1) creating a object URL and passing it to the embed or iframe tag. This works fine in Chrome but not in IE.
</head><body><input type="file" onchange="previewFile()"><iframe id="test_iframe" style="width:100%;height:500px;"></iframe><script> function previewFile() { var file = document.querySelector('input[type=file]').files[0]; var downloadUrl = URL.createObjectURL(file); console.log(downloadUrl); var element = document.getElementById('test_iframe'); element.setAttribute('src',downloadUrl); }</script></body>
2) I have also tried wrapping the URL Blob inside a encodeURIcomponent()
We can't use window.navigator.msSaveOrOpenBlob() as we want to pass the blob url inside an embed, iframe or anchor tag to display in a html page and not download or open
Any pointers on how I can approach to solve this?