【问题标题】:Pdfs not displaying in fancybox 2 iframe in IE9, 10 and 11Pdfs 未显示在 IE9、10 和 11 中的 fancybox 2 iframe 中
【发布时间】:2013-10-08 06:23:49
【问题描述】:

我在 Fancybox 2 iframe 中成功加载了适用于 Google Chrome、Safari、Opera、Firefox 和 IE 8 的 pdf。但是,对于 IE 9、10 和 11,iframe 是空的。有没有人有在 Fancybox 中加载 pdf 的解决方案2 iframe,专门针对IE9、10和11? iframe 显示,但为空,页面底部有一个问题询问您是否要打开或保存 pdf。如果选择打开,则会打开一个新窗口并显示 pdf(不在 iframe 中)。该网站使用 HTML5 和 CSS3。以下是部分代码:

HTML 代码页:

<!doctype html>

<a class="fancybox fancybox.iframe" href="PDFs/myfile.pdf"></a>

HTML 代码页上的脚本(抱歉,我的帖子中似乎无法正确排列):

<script type="text/javascript">
    $(document).ready(function() {
 $(".fancybox").fancybox({
       width : "85%",
       height : "80%",
 autoSize: false,
 iframe : {
    preload: false,
 'content': '<embed src="'+this.href+'#nameddest=self&page=1&view=FitH,0&zoom=80,0,0" type="application/pdf" height="99%" width="100%" />'      
       }
     });
 });
 </script>

我已经搜索了许多已经提出的问题以寻求解决方案,尝试了许多建议,但仍然无法在 IE 9、10 或 11 中显示 pdf。注意:“iframe preload: false”脚本确实在 Google 中解决了这个问题Chrome 和 IE8,感谢任何发布这些建议的人。

如果有人知道如何解决此问题,请提供帮助。谢谢!

【问题讨论】:

    标签: javascript jquery html pdf iframe


    【解决方案1】:

    IE 没有像苹果那样的嵌入式 pdf 查看器。您需要使用自己的 PDF.js 实现,如果您想显示内联或可能确保包含 acrobat 扩展并且您的 mime 类型正确。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-30
      • 2014-04-29
      • 2014-12-26
      • 1970-01-01
      • 2014-03-28
      相关资源
      最近更新 更多