【问题标题】:iFrame not displaying PDF pageiFrame 不显示 PDF 页面
【发布时间】:2021-05-02 09:47:10
【问题描述】:

我正在尝试将 PDF 加载到 iFrame 中。 src 设置为从数据库接收到的 URL。

<div class="row">
    <div class="col-md-8">
        <iframe runat="server" src="{{quotation.quotationFile.url}}" 
          width="100%" height="500px">  </iframe>
    </div>
</div>

我正在尝试使用从数据库接收到的src 加载 iFrame。但它没有显示:

This content can’t be shown in a frame
There is supposed to be some content here, but the publisher doesn’t allow it to be displayed in a frame. This is to help protect the security of any information you might enter into this site.

【问题讨论】:

标签: html django pdf iframe


【解决方案1】:

也许框架将“X-Frame-Options”设置为“sameorigin”。 在 Django 中有 3 个 X-Frame-Options

  1. 拒绝
  2. 同源
  3. 允许-RROM

可以参考这个:https://docs.djangoproject.com/en/3.1/ref/clickjacking/#an-example-of-clickjacking

【讨论】:

  • 你能解释一下,我必须如何设置 X-Frame-Options
猜你喜欢
  • 1970-01-01
  • 2013-02-03
  • 2012-02-10
  • 2016-08-08
  • 1970-01-01
  • 2010-12-28
  • 1970-01-01
  • 2014-09-04
  • 1970-01-01
相关资源
最近更新 更多