Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

Not able to embed PDF blob in HTML in IE

$
0
0

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?



Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>