如何正确设置Xframe选项以显示PDF

发布于 2025-02-07 00:51:21 字数 261 浏览 0 评论 0原文

因此,我在尝试使用HTML渲染PDF时会遇到此错误

拒绝显示'http://127.0.0.1:8000/'在框架中,因为它将'x-frame-options'设置为“拒绝”。

我已经尝试

  1. 设置x_frame_options ='sameorigin''
  2. 使用@xframe_options_sameorigin作为我视图的装饰
  3. 删除了设置中的xframe软件包,

所以我不知道该怎么做。

So I get this error when trying to render a pdf in html with

Refused to display 'http://127.0.0.1:8000/' in a frame because it set 'X-Frame-Options' to 'deny'.

I already tried

  1. Setting X_FRAME_OPTIONS = 'SAMEORIGIN'
  2. Using @xframe_options_sameorigin as decorator to my view
  3. Removed the xframe package in the settings

nothing seems to work so I don't know what to do anymore.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海的爱人是光 2025-02-14 00:51:21

因此,我做了更多的研究,对我有用的是:

从网页上进行硬重新加载

这清除了缓存,这通常会导致开发问题
https://www.sunililchauhan.com /学习/什么做 - ctrl-shift-r-do-in-chrome/

So I did some more research and what worked for me was:

Doing a hard reload from the webpage:

This clears the cache which often causes issues in development
https://www.sunilchauhan.com/learn/what-does-ctrl-shift-r-do-in-chrome/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文