【问题标题】:Refused to display Oauth Twitter page in iframe because 'X-Frame-Options' is set to 'SAMEORIGIN'拒绝在 iframe 中显示 Oauth Twitter 页面,因为“X-Frame-Options”设置为“SAMEORIGIN”
【发布时间】:2015-11-25 14:56:00
【问题描述】:

我正在 Grails 中创建一个网站,我想在 iframe 窗口中使用我的页面。但是当我在 iframe 中打开 twitter 的 Oauth 页面时,它会显示错误:

拒绝显示 'https://api.twitter.com/oauth/authorize?oauth_token=token' 在一个框架中 因为它将“X-Frame-Options”设置为“SAMEORIGIN”

当我想在 iframe 中打开 google+、wordpress 和 youtube Oauth 访问页面时,也会出现此错误。

如果是 google+:

拒绝显示 'https://accounts.google.com/AccountChooser?continue=https%3A%2F%2Faccounts....%26hl%3Den%26from_login%3D1%26as%3D66a03fa55190219f&btmpl=authsub&hl=en_GB' 在一个框架中,因为它将“X-Frame-Options”设置为“DENY”。

如果是wordpress:

拒绝显示 'public-api.wordpress.com/oauth2/authorize?client_id=33528&redirect_url=/login/oAuthCallBack&response_type=code&state=0001x02' 在一个框架中,因为它将“X-Frame-Options”设置为“SAMEORIGIN”

请提出任何解决方案,如何在 iframe 中打开这些页面。

【问题讨论】:

  • 您有没有想过,为什么不允许您在 iframe 元素中显示这些页面?

标签: wordpress grails iframe twitter oauth


【解决方案1】:

嗯,基本上……你不能。即使你让它工作,它也可能不会在所有浏览器上工作。例如,我曾经在 Goggle Chrome 中绕过 SAMEORIGIN 限制,但在 Safari 中完全失败。

我的解决方案是放弃使用 iframe。

【讨论】:

    猜你喜欢
    • 2016-03-21
    • 2020-07-02
    • 2017-06-05
    • 2016-07-13
    • 2013-12-28
    • 2017-05-22
    • 2022-11-29
    相关资源
    最近更新 更多