点击iframe后,Facebook页面全屏获取 [英] Facebook page acquire full screen after clicking on iframe

查看:84
本文介绍了点击iframe后,Facebook页面全屏获取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在打开我在我的页面
上创建的IFRAME中的Facebook身份验证页面,但是问题是一旦页面加载到iframe,我点击iframe,Facebook身份验证页面就会获取整个页面全屏幕和iframe消失。

i am trying to open facebook authentication page in IFRAME that i have created on my page but the problem is once the page get loaded into iframe and i click on an iframe the facebook authentication page acquires the whole page in a full screen and iframe get vanish.

https://graph.facebook.com/oauth/authorize?client_id=<id>&type=user_agent&redirect_uri=http://localhost:3662/test.web/pages/z.aspx&display=popup

这里是我的url,我正在设置iframe src属性

here is my url that i am setting in iframe src attribute

推荐答案

我刚跑进入我自己我使用的解决方案?

I just ran into this myself. The solution I used?

Javascript验证

粗暴的步骤

// trigger this any way you want
window.open(
    'https://graph.facebook.com/oauth/authorize?client_id=CLIENT_ID&display=popup&scope=PERM_LIST&redirect_url=http://example.com/oauth_redirect'
  , 'authorize'
  , 'width=600,height=350'
);

这将在弹出窗口中显示验证窗口。现在,下一步你使用重定向网址(在我的例子中, http://example.com/oauth_redirect

This displays the authentication window in a popup. Now, the next bit what you do with the redirect url (in my example, http://example.com/oauth_redirect)

URL中的access_token参数包含OAuth令牌,因此可以使用它检索并执行所需的任何操作(存储在cookie中,无论如何)。然后使用JS来控制弹出窗口和开启者会发生什么事情

The access_token parameter in the URL holds the OAuth token - so retrieve that and do whatever you need to with it (store in a cookie, whatever). And then use JS to control what happens to the popup and opener

<script type="text/javascript">

// Perhaps load the next page?
window.opener.location = 'http://example.com/canvas'

// close the popup
window.close();

</script>

请参阅此相关论坛帖子

这篇关于点击iframe后,Facebook页面全屏获取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆