尝试使用jQuery模式弹出窗口查看pdf文件虽然iframe [英] Attempting to view pdf file though iframe using jQuery modal popup
问题描述
我正在尝试使用jQuery模式弹出窗口显示pdf文件,但是,它要求用户在页面加载时下载文件,而不是在模式对话框打开时嵌入iframe内的pdf文件。 / p>
我该如何解决这个问题?
我正在使用MVC输出pdf文件,而打开而不是下载,我使用了这个:
Response.AddHeader(Content-Disposition,inline; filename = mypdf.pdf);
为了在对话框中查看它我选择在div中使用iframe,这成了我的对话框:
< div class =dialogstyle =display:none; overflow:scroll;>
< iframe src =mypdf.pdf>< / iframe>
< / div>
...
$(。dialog)。dialog();
确保对话框div的溢出设置为auto以外的值。否则它不会在IE上显示。
如果您需要一个示例,请查看此链接: http://helpdesk.toitl.com/data/p/toitl.com/dv/dialog_with_pdf/
I am trying to display a pdf file though iframe using jQuery modal popup, however, it's asking the user to download the file when the page loads instead of the pdf file being embedded inside the iframe when the modal dialog opens up.
How can I get around this?
I'm using MVC to output the pdf file, and to open instead of downloading, I used this:
Response.AddHeader("Content-Disposition", "inline; filename=mypdf.pdf");
For the sake of viewing it inside a dialog I choose to use an iframe inside a div, wich became my dialog:
<div class="dialog" style="display:none; overflow:scroll;">
<iframe src="mypdf.pdf"></iframe>
</div>
...
$(".dialog").dialog();
Make sure that your dialog div has overflow set to something different than 'auto'. Otherwise it wont display on IE.
Take a look at this link, if you need an example: http://helpdesk.toitl.com/data/p/toitl.com/dv/dialog_with_pdf/
这篇关于尝试使用jQuery模式弹出窗口查看pdf文件虽然iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!