Facebook的iframe应用程序 - 奇怪的重定向问题 [英] Facebook Iframe App - Strange Redirection Problems

查看:205
本文介绍了Facebook的iframe应用程序 - 奇怪的重定向问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Facebook iframe应用程序中进行服务器端重定向时,我得到了一个这个奇怪的Facebook徽标链接。当我点击它,我被重定向到网站我设置重定向到第一位。这里发生了什么?任何点击保护到位?

When I'm doing a server-side redirection in a Facebook iframe application, I get the this strange Facebook Logo with a link. When I click it, I get redirected to site I set the redirection to in the first place. What happens here? Any "Click Protection" in place?

谢谢!

重定向代码:

尝试客户端重定向

    args = dict(client_id=FACEBOOK_APP_ID, redirect_uri=base_dir , scope='user_photos,email,offline_access')
    return render_to_response('fb/nopermission.html', { 'javascript': "<script>window.top.location=\"" + "https://graph.facebook.com/oauth/authorize?" + urllib.urlencode(args )+ "\"</script>"  } )

服务器重定向

args = dict(client_id=FACEBOOK_APP_ID, redirect_uri=base_dir , scope='user_photos,email,offline_access')
return HttpResponseRedirect(https://graph.facebook.com/oauth/authorize?" + urllib.urlencode(args))

相同结果在这两种情况下

Same Result in both cases

推荐答案

对于重定向目的,请使用以下代码:

For redirection purpose use this code:

<html><head>
<script type="text/javascript">
  window.top.location.href = "<?php echo $loginUrl; ?>";
</script>
<noscript>
  <meta http-equiv="refresh" content="0;url=<?php echo $loginUrl; ?>" />
  <meta http-equiv="window-target" content="_top" />
</noscript>

这篇关于Facebook的iframe应用程序 - 奇怪的重定向问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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