我希望用户能够通过在任何移动浏览器上访问时点击链接来查看pdf。我已经尝试了,但两者都给出了“此插件不受支持”的错误
<div id="pdf">
<iframe src="https://www.adobe.com/products/pdfjobready/pdfs/pdftraag.pdf" style="width: 100%; height: 100%;" frameborder="0" scrolling="no">
<p>It appears your web browser doesn't support iframes.</p>
</iframe>
</div>
<object data="lorem.pdf" type="application/pdf">
<p>It appears you don't have Adobe Reader or PDF support in this web browser. <a href="lorem.pdf">Click here to download the PDF</a>. Or <a href="http://get.adobe.com/reader/" target="_blank">click here to install Adobe Reader</a>.</p>
<embed src="lorem.pdf" type="application/pdf" />
</object>
答案 0 :(得分:1)
您可以使用Google文档查看器
<iframe src="http://docs.google.com/viewer?url=" + PathToMyPdfFile + "&embedded=true" width="100%" height="100%" style="width: 100%; height: 100%;" frameborder="0" scrolling="no"></iframe>
答案 1 :(得分:0)
如上所述,使用 Google文档查看器。
工作示例:
<iframe src="https://docs.google.com/viewer?url=https://www.antennahouse.com/XSLsample/pdf/sample-link_1.pdf&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>
将示例链接https://www.antennahouse.com/XSLsample/pdf/sample-link_1.pdf
替换为您想要的任何PDF。
注意:
如果您在此处收到此错误:
Mixed Content: The page at 'link' was loaded over HTTPS
确保链接中包含https://
。