pdf加载到iframe时如何防止下载? [英] how to prevent download when the pdf load to iframe?

查看:4020
本文介绍了pdf加载到iframe时如何防止下载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当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阅读< a href =http://php.net/manual/en/book.pdf.php =nofollow>细节在这里



将帮助您在使用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=true

Using PHP read the details here

This will help you as well in reading file using PHP: http://www.setasign.com/products/fpdi/about/

这篇关于pdf加载到iframe时如何防止下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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