-->

How to show PDF in Internet Explorer 9 using base6

2020-08-03 06:53发布

问题:

I am trying to show a PDF in IE9. I don't want the user to know any URL file info. So I am encoding the PDF file into BASE64 and use the tag:

<iframe src="data:application/pdf;base64,JVBER..." width="500" height="500"></iframe>

It works fine using the latest versions of Chrome and Firefox... but not with IE9.

Tips?

回答1:

This is not directly possible in this way-- Internet Explorer does not permit use of DATA URIs as the source of frames. You may be able to use an OBJECT tag with the PDF Reader CLSID and a DATA URI of the entire document, but it's up to the PDF reader to decide whether they support that.

It's not really clear what you hope to accomplish here, though, since a user can reconstitute the original document from the source if they want to do so.