本文介绍了pdf加载到iframe时如何防止下载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 当iframe使用pdf加载时自动下载pdf文件。如何防止这种情况。 $(function(){ $(#dialog)。dialog { autoOpen:false, modal:true, resizable:false, width:auto, show:fade, hide :'fade', height:auto, open:function(ev,ui){ $('#main_iframe')。attr('src',($(' #dialog')。data('url'))); } }); $('#btn_ca')。click(function ){ $('#dialog')。data('url','consumer_affairs.pdf'); $('#dialog')。dialog('open'); }); 解决方案例如 Google Viewer 。 示例: http://docs.google.com /gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true 使用PHP阅读细节在这里 将帮助您在使用PHP阅读文件时: http://www.setasign.com/products / fpdi / about / When the iframe loading with pdf automatically download the pdf file. How can i prevent this. $(function () { $("#dialog").dialog({ autoOpen: false, modal: true, resizable: false, width: "auto", show: "fade", hide: "fade", height: "auto", open: function(ev, ui){ $('#main_iframe').attr('src',($('#dialog').data('url'))); }});$('#btn_ca').click(function(){ $('#dialog').data('url', 'consumer_affairs.pdf'); $('#dialog').dialog('open');}); 解决方案 Use some PDF viewer to avoid it downloadable. Google Viewer for instance.Example:http://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=trueUsing PHP read the details hereThis will help you as well in reading file using PHP: http://www.setasign.com/products/fpdi/about/ 这篇关于pdf加载到iframe时如何防止下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 15:45