我正在开发一个网站,应该是响应,以便人们可以从他们的手机访问它。该网站有一些安全的部分,可以登录使用谷歌,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。

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


当前回答

试着使用

https://www.youtube.com/embed/YOUR_VIDEO_CODE

你可以在“嵌入式代码”部分找到所有的嵌入式代码,它看起来像这样

<iframe width="560" height="315"  src="https://www.youtube.com/embed/YOUR_VIDEO_CODE" frameborder="0" allowfullscreen></iframe>

其他回答

我做了下面的改变,并为我工作良好。

只需添加属性<iframe src="URL" target="_parent" />

_parent:这将在同一个窗口中打开嵌入的页面。

_blank:在不同的选项卡

试着使用

https://www.youtube.com/embed/YOUR_VIDEO_CODE

你可以在“嵌入式代码”部分找到所有的嵌入式代码,它看起来像这样

<iframe width="560" height="315"  src="https://www.youtube.com/embed/YOUR_VIDEO_CODE" frameborder="0" allowfullscreen></iframe>

我找到了更好的办法,也许能帮到别人 取代“手表吗?V =" by " V /"这是可行的

var url = url.replace("watch?v=", "v/");

在本例中,他们将报头设置为SAMEORIGIN,这意味着他们不允许在域外的iframe中加载资源。所以这个iframe不能跨域显示

为此,您需要匹配apache或您正在使用的任何其他服务中的位置

如果你使用apache,那么在httpd.conf文件中。

  <LocationMatch "/your_relative_path">
      ProxyPass absolute_path_of_your_application/your_relative_path
      ProxyPassReverse absolute_path_of_your_application/your_relative_path
   </LocationMatch>

有一个类似的问题,嵌入youtube聊天,我想出了它。也许类似的问题有类似的解决方案。

Refused to display 'https://www.youtube.com/live_chat?v=yDc9BonIXXI&embed_domain=your.domain.web' in a frame because it set 'X-Frame-Options' to 'sameorigin'

我的网页工作有www和没有它。所以为了让它正常工作,你需要确保你加载了embed_domain= value…也许你缺少一个变量来告诉你在哪里嵌入你的iframe。为了解决我的问题,必须写一个脚本来检测正确的网页和执行适当的iframe嵌入域名。

<iframe src='https://www.youtube.com/live_chat?v=yDc9BonIXXI&embed_domain=your.domain.web' width="100%" height="600" frameborder='no' scrolling='no'></iframe>

or

<iframe src='https://www.youtube.com/live_chat?v=yDc9BonIXXI&embed_domain=www.your.domain.web' width="100%" height="600" frameborder='no' scrolling='no'></iframe>

要知道你没有使用iframe,但是仍然可能需要添加一些变量到你的语法中,以告诉它脚本将在哪里使用。