【问题标题】:How to view PDF file in an iframe using onsenui and google docs pdf viewer?如何使用 onsenui 和 google docs pdf 查看器在 iframe 中查看 PDF 文件?
【发布时间】:2018-06-29 01:54:20
【问题描述】:

当我在onsenui 的 iframe 中使用 google docs 查看器时,为什么会出现以下错误?

错误

Refused to display 'https://docs.google.com/viewer?url=http://www.pdf995.com/samples/pdf.pdf' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

代码

<div class="card">
      <iframe src="https://docs.google.com/viewer?url=http://www.pdf995.com/samples/pdf.pdf" height="200" width="300"></iframe>
</div>

编辑

我刚刚意识到,即使在不使用 oneen 的纯 html 中,它仍然会给出相同的错误。

【问题讨论】:

    标签: html google-docs onsen-ui x-frame-options


    【解决方案1】:

    我刚刚发现问题不在于温泉。要查看pdf文件,只需在url中添加&amp;embedded=true即可。

    <iframe src="http://docs.google.com/gview?url=http://www.pdf995.com/samples/pdf.pdf&embedded=true" style="width:100%; height:1000px;" frameborder="0"></iframe>
    

    【讨论】:

      猜你喜欢
      • 2011-01-16
      • 1970-01-01
      • 2015-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多