我正在开发一个网站,应该是响应,以便人们可以从他们的手机访问它。该网站有一些安全的部分,可以登录使用谷歌,Facebook,…等(OAuth)。

服务器后端是用ASP开发的。Net Web API 2,前端主要是AngularJS加上一些Razor。

对于身份验证部分,在包括Android在内的所有浏览器中,一切都很好,但谷歌身份验证在iPhone上不起作用,它给我这个错误消息

Refused to display 'https://accounts.google.com/o/openid2/auth
?openid.ns=http://specs.openid.ne…tp://axschema.org/namePerson
/last&openid.ax.required=email,name,first,last'
in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

现在就我而言,我没有在我的HTML文件中使用任何iframe。

我搜索了一下,但没有答案让我解决这个问题。


当前回答

如果你在vimeo中使用iframe,请更改url:

https://vimeo.com/63534746

to:

http://player.vimeo.com/video/63534746

这对我很管用。

其他回答

在使用iframe注销具有不同域的子站点时遇到了类似的问题。我使用的解决方案是首先加载iframe,然后在加载帧后更新源代码。

var frame = document.createElement('iframe'); Frame.style.display = 'none'; 框架。setAttribute(“src”、“:空白”); document.body.appendChild(框架); 框架。addEventListener('load', () => { 框架。setAttribute(“src”,url); });

在apache上,你需要编辑security.conf:

nano /etc/apache2/conf-enabled/security.conf

并设置:

Header set X-Frame-Options: "sameorigin"

然后启用mod_headers:

cd /etc/apache2/mods-enabled

ln -s ../mods-available/headers.load headers.load

重启Apache:

service apache2 restart

瞧!

如果你在vimeo中使用iframe,请更改url:

https://vimeo.com/63534746

to:

http://player.vimeo.com/video/63534746

这对我很管用。

使用URL后缀添加以下内容

/override-http-headers-default-settings-x-frame-options

如果你在谷歌文档查看器中使用iframe,请更改iframe:

Iframe src="https://docs.google.com/viewer?url=' + url_your_document .

to:

Iframe src="https://docs.google.com/viewer?url=' + url_your_document + '&embedded=true"

这对我很管用。