使用iframe时,嵌入式base64 pdf不会在IE中显示 [英] Embedded base64 pdf won't display in IE when using iframe

查看:3067
本文介绍了使用iframe时,嵌入式base64 pdf不会在IE中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望显示一个在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆