Ali*_*mer 252 asp.net-web-api angularjs google-oauth
我正在开发一个应该响应的网站,以便人们可以通过手机访问它.该网站有一些安全的部分,可以使用谷歌,Facebook,...等登录(OAuth).
服务器后端是使用ASP.Net Web API 2开发的,前端主要是带有Razor的AngularJS.
对于身份验证部分,一切都在包括Android在内的所有浏览器中正常运行,但Google身份验证在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'.
Run Code Online (Sandbox Code Playgroud)
现在到目前为止我担心我的HTML文件中不使用任何iframe.
我用Google搜索,但没有回答让我解决问题.
小智 164
我发现了一个更好的解决方案,也许它可以帮助别人替代"watch?v="的"v/",它会工作
var url = url.replace("watch?v=", "v/");
Run Code Online (Sandbox Code Playgroud)
Ali*_*mer 84
在这篇SO帖子的帮助下,花了更多的时间在这之后确定了
我设法通过&output=embed在发布到Google网址之前添加到网址末尾来解决问题:
var url = data.url + "&output=embed";
window.location.replace(url);
Run Code Online (Sandbox Code Playgroud)
Bog*_*aru 38
尝试使用
您可以在"嵌入代码"部分找到所有嵌入代码,看起来像这样
<iframe width="560" height="315" src="https://www.youtube.com/embed/YOUR_VIDEO_CODE" frameborder="0" allowfullscreen></iframe>
Run Code Online (Sandbox Code Playgroud)
Ibt*_*tif 31
在这种情况下,他们已将标头设置为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>
Run Code Online (Sandbox Code Playgroud)
Irf*_*mad 11
要将youtube视频嵌入到angularjs页面中,您只需对视频使用以下过滤器即可
app.filter('scrurl', function($sce) {
return function(text) {
text = text.replace("watch?v=", "embed/");
return $sce.trustAsResourceUrl(text);
};
});Run Code Online (Sandbox Code Playgroud)
<iframe class="ytplayer" type="text/html" width="100%" height="360" src="{{youtube_url | scrurl}}" frameborder="0"></iframe>Run Code Online (Sandbox Code Playgroud)
小智 6
我做了以下更改,对我来说效果很好。
只需添加属性 <iframe src="URL" target="_parent" />
_parent:这将在同一窗口中打开嵌入式页面。
_blank:在其他标签中
| 归档时间: |
|
| 查看次数: |
614384 次 |
| 最近记录: |