如何正确设置Xframe选项以显示PDF
因此,我在尝试使用HTML渲染PDF时会遇到此错误
拒绝显示'http://127.0.0.1:8000/'在框架中,因为它将'x-frame-options'设置为“拒绝”。
我已经尝试
- 设置x_frame_options ='sameorigin''
- 使用@xframe_options_sameorigin作为我视图的装饰
- 删除了设置中的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
- Setting X_FRAME_OPTIONS = 'SAMEORIGIN'
- Using @xframe_options_sameorigin as decorator to my view
- Removed the xframe package in the settings
nothing seems to work so I don't know what to do anymore.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,我做了更多的研究,对我有用的是:
从网页上进行硬重新加载:
这清除了缓存,这通常会导致开发问题
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/