Html IFRAME:拒绝显示文档,因为 X-Frame-Options 禁止显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13336851/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:50:16  来源:igfitidea点击:

IFRAME: Refused to display document because display forbidden by X-Frame-Options

htmlsecurityiframeherokux-frame-options

提问by Quentin

Possible Duplicate:
Overcoming “Display forbidden by X-Frame-Options”

可能的重复:
克服“X-Frame-Options 禁止显示”

I have this HTML code on a server (Heroku). From the iframe of www.example.com I click on the "login to google" button, but I get this error message:

我在服务器(Heroku)上有这个 HTML 代码。从 www.example.com 的 iframe 我点击“登录到谷歌”按钮,但我收到此错误消息:

Refused to display document because display forbidden by X-Frame-Options

I tried adding the <meta http-equiv="X-Frame-Options" content="GOFORIT">on the header of www.example.com but still doesn't work. Any ideas? Thanks

我尝试<meta http-equiv="X-Frame-Options" content="GOFORIT">在 www.example.com 的标题上添加 ,但仍然不起作用。有任何想法吗?谢谢

<html>
<head>
<title>Test</title>
</head>
<body>
<iframe src="http://www.example.com" width=1000 height=1000></iframe>
</body>
</html>

回答by Quentin

You have to use real HTTP response headers. <meta http-equiv>isn't really equivalent.

您必须使用真正的 HTTP 响应标头。<meta http-equiv>不是真的等价。

How you set those depends on your server and/or server side programming language.

您如何设置这些取决于您的服务器和/或服务器端编程语言。

e.g. for Apache, with mod_headers:

例如对于 Apache,使用mod_headers

Header set X-Frame-Options GOFORIT

… will do the job.

......会完成这项工作。