如何强制在iframe中不下载pdf [英] How to force to not download pdf in iframe

查看:159
本文介绍了如何强制在iframe中不下载pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<body>
<iframe src='howto.pdf' height='800px' width='500px'> </iframe>
</body>

当我只是简单地在浏览器中打开howto.php时,此代码可以正常工作(显示iframe).但是,当我在localhostserver中打开此php文件时,它没有显示iframe,idm poup并说我们要下载该文件. (((我将此文件另存为howto.php))

This code works fine(show iframe)when i just simple open howto.php in a browser. But when i open this php file in localhostserver it doesn't show the iframe, idm poup and say us to download the file. (( i save this file as howto.php ))

推荐答案

如果您的pdf具有公开网址,则可以通过这种方式使用google pdf查看器

if your pdf has a public url you can use google pdf viewer in this way

<iframe src="http://docs.google.com/gview?url=yourPdfUrl&embedded=true" style="width:800px; height:500px;" frameborder="0"></iframe>

用您的实际pdf网址替换yourPdfUrl,例如http://www.example.com/myDoc.pdf

replace yourPdfUrl with your real pdf url e.g. http://www.example.com/myDoc.pdf

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

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