使用iframe时,嵌入式base64 pdf不会在IE中显示 [英] Embedded base64 pdf won't display in IE when using iframe
问题描述
我希望显示一个在html中使用base64编码嵌入的pdf文件。
以下是我为此编写的代码。 PDF文件在Chrome和Firefox中显示,但不在Internet Explorer中显示。
任何想法如何让它在IE中工作? Adobe Reader插件适用于IE。
>< / iframe中>由于字符限制,我无法粘贴基本编码的字符串。但它的大小为401676字符。
除了it是一个可怕的解决方案之外,这里是我要做的:
< iframe src =/ unbase64.php?mime = application / pdf& str = baseEncodedString>< / iframe>
然后
<?php
header(Content-Type:。$ _GET [mime]);
echo base64_decode($ _ GET [str]);
?>
愚蠢并且可能会经常遇到最大URL长度,但它在原理上是有效的。
I wish to display a pdf file which is embedded using base64 encoding in an html. Below is the code I have written for this. The pdf file is displayed in Chrome and firefox but not in Internet Explorer .
Any idea how to get it working in IE? Adobe Reader plugin is properly working in IE for me.
<iframe src="data:application/pdf;base64,baseEncodedString"></iframe>
I am not able to paste the base encoded string because of character limits.But it is of size 401676 characters.
Aside from "it" being a terrible solution, here is what I would do:
<iframe src="/unbase64.php?mime=application/pdf&str=baseEncodedString"></iframe>
and then
<?php
header("Content-Type: " . $_GET["mime"]);
echo base64_decode($_GET["str"]);
?>
Stupid and will probably hit the maximum URL length often, but it works in principle.
这篇关于使用iframe时,嵌入式base64 pdf不会在IE中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!