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

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


当前回答

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

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

其他回答

Youtube /embed,两种口味:

https://www.youtube.com/embed/watch?v=eAxV4uO8oTU&list=RDeAxV4uO8oTU&start_radio=1 https://www.youtube.com/embed/CNG7yrHHJ5A

粘贴到浏览器中查看

原文:

https://www.youtube.com/watch?v=eAxV4uO8oTU&list=RDeAxV4uO8oTU&start_radio=1 https://www.youtube.com/watch?v=CNG7yrHHJ5A

一个人需要保持“守望”?V=",另一个不是

使用URL后缀添加以下内容

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

试着使用

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/");

为了将youtube视频嵌入到你的angularjs页面中,你可以简单地为你的视频使用以下过滤器

app.filter('scrurl', function($sce) { 返回函数(文本) { text = text.replace(“watch?v=”, “embed/”); 返回 $sce.trustAsResourceUrl(text), }; }); <iframe class=“ytplayer” type=“text/html” width=“100%” height=“360” src=“{{youtube_url | scrurl}}” frameborder=“0”></iframe>