Html 嵌入标签不在移动浏览器上显示 pdf 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18432790/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
embed tag not displaying pdf file on mobile browsers
提问by Siddharth Sharma
I used embed tag to show a pdf file on my html page and it is displaying the pdf file very well on a desktop and laptop browser but that is not showing the pdf file on moblie and talbets , is there any way I can make them appear on mobile as well . Here is the concerned code :
我使用 embed 标签在我的 html 页面上显示 pdf 文件,它在台式机和笔记本电脑浏览器上很好地显示了 pdf 文件,但没有在 moblie 和 talbets 上显示 pdf 文件,有什么办法可以让它们出现在手机上也是如此。这是相关的代码:
<embed src="assets/img/jimbosmenu.pdf" width="900" height="900">
Here is the link to live page . http://jimbosjoint.com/menu
这是直播页面的链接。 http://jimbosjoint.com/menu
回答by Kevin Lynch
You need to use object
, not embed
您需要使用object
,而不是embed
<object data="filename.pdf" type="application/pdf" width="100%" height="100%">
<p>Your web browser doesn't have a PDF plugin.
Instead you can <a href="filename.pdf">click here to
download the PDF file.</a></p>
</object>
回答by Tuxes3
show it from google docs like that:
从谷歌文档中显示它:
<object width="900" height="900" data="https://docs.google.com/gview?embedded=true&url=http://jimbosjoint.com/assets/img/jimbosmenu.pdf"></object>
回答by mynetx
The <embed>
tag is outdated. Consider using the <object>
tag. However, it might be a better option to link to the PDF file, so the mobile user can view it in full screen.
该<embed>
标签已经过时。考虑使用<object>
标签。但是,链接到 PDF 文件可能是更好的选择,以便移动用户可以全屏查看。