简体   繁体   English

在IE9、10和11中的fancybox 2 iframe中不显示pdf

[英]Pdfs not displaying in fancybox 2 iframe in IE9, 10 and 11

I have pdfs successfully loading in Fancybox 2 iframes for Google Chrome, Safari, Opera, Firefox and IE 8. However, the iframe is empty for IE 9, 10 and 11. Does anyone have a solution for loading pdfs in a Fancybox 2 iframe, specifically for IE9, 10 and 11? 我已经在Google Chrome,Safari,Opera,Firefox和IE 8的Fancybox 2 iframe中成功加载了pdf。但是,对于IE 9、10和11,该iframe为空。是否有人可以在Fancybox 2 iframe中加载pdf,专门针对IE9、10和11? The iframe displays, but is empty and there is a question at the bottom of the page asking if you want to open or save the pdf. iframe会显示,但为空,页面底部会出现一个问题,询问您是否要打开或保存pdf。 If you select open, a new window opens and displays the pdf (not in the iframe). 如果选择打开,则会打开一个新窗口并显示pdf(不在iframe中)。 The website uses HTML5 & CSS3. 该网站使用HTML5和CSS3。 Here is some of the code: 这是一些代码:

HTML code page: HTML代码页:

<!doctype html>

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

Script on HTML code page (sorry, but I can't seem to get this to line up correctly in my post): 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>

I have searched through many already asked questions for a solution, tried many suggestions and still cannot get the pdfs to display in IE 9, 10 or 11. Note: the "iframe preload: false" script did solve this issue in Google Chrome and IE8, so thank you for anyone who posted those suggestions. 我已经搜索了很多已经问过的问题的解决方案,尝试了许多建议,但仍然无法在IE 9、10或11中显示pdf。注意:“ iframe preload:false”脚本确实在Google Chrome和IE8中解决了此问题,因此感谢您发布这些建议的任何人。

Please help if anyone knows how to solve this problem. 如果有人知道如何解决此问题,请提供帮助。 Thank you! 谢谢!

IE doesn't have an embedded pdf viewer like apple has. IE没有像Apple那样具有嵌入式pdf查看器。 You need to use your own PDF.js implementation, if you want to display inline or possible make sure acrobat extensions are included and that your mime type is proper. 如果要内联显示或可能的话,您需要使用自己的PDF.js实现,请确保包含了acrobat扩展名并且您的mime类型正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM