【问题标题】:HTML embed PDF not work in mobile ChromeHTML 嵌入 PDF 在移动 Chrome 中不起作用
【发布时间】:2017-02-02 21:11:18
【问题描述】:

我想在我的网站上显示 PDF 文件。

这是我的代码,在 Chrome 的正常设置下完美运行

<html>
<object data="http://health.ntuh.gov.tw/health/NTUH_e_Net/NTUH_e_Net_no91/%E7%99%8C%E7%97%87%E7%AF%A9%E6%AA%A2.pdf" type="application/pdf" width="1000" height="1000">
  <embed src="http://health.ntuh.gov.tw/health/NTUH_e_Net/NTUH_e_Net_no91/%E7%99%8C%E7%97%87%E7%AF%A9%E6%AA%A2.pdf" type="application/pdf" />
</object>
</html>

但在 Chrome 的 Toogle 设备工具栏中的移动设置中不起作用(见下图)

Chrome's Toogle device toolbar

这会是 Chrome 中的错误还是其他问题? 请帮帮我,谢谢!

【问题讨论】:

    标签: html google-chrome embed


    【解决方案1】:

    您必须安装 Chrome 插件才能查看 pdf。使用此代码。

    <div id="content">
    <object data="http://health.ntuh.gov.tw/health/NTUH_e_Net/NTUH_e_Net_no91/%E7%99%8C%E7%97%87%E7%AF%A9%E6%AA%A2.pdf" width="100%" height="700px"> 
      <p>It appears you don't have a PDF plugin for this browser.</p>
      <p id="missing-pdf-plugin">You can <a href="http://health.ntuh.gov.tw/health/NTUH_e_Net/NTUH_e_Net_no91/%E7%99%8C%E7%97%87%E7%AF%A9%E6%AA%A2.pdf">click here to
      download the PDF file</a>.</p>
    </object>
    
    <script type="text/javascript">
    $(document).ready(function(){
        if ( $.browser.mozilla) { // firefox
            var msg = "You can <ul><li>either install a PDF plugin such as <a href='https://addons.mozilla.org/en-US/firefox/addon/pdfjs/'>this one</a> and refresh this page,</li><li>or <a href='http://health.ntuh.gov.tw/health/NTUH_e_Net/NTUH_e_Net_no91/%E7%99%8C%E7%97%87%E7%AF%A9%E6%AA%A2.pdf'>click here to download PDF file</a>.</li></ul>";
            $("#missing-pdf-plugin").html(msg);
        }
    });
    </script>

    【讨论】:

    • 也许我有答案... Chrome 必须安装一个名为 pdf 查看器的扩展
    猜你喜欢
    • 2015-01-03
    • 1970-01-01
    • 2022-06-15
    • 1970-01-01
    • 2014-02-17
    • 2015-01-29
    • 1970-01-01
    • 2017-04-28
    • 2018-05-15
    相关资源
    最近更新 更多