<fb:login-button onlogin="window.location = '/custompage.html';">Connect</fb:login-button>
这是我用户登录我网站的代码。它在FBML中。
它将弹出一个框,然后用户登录。然后,它关闭新窗口,然后重定向到“ custompage.html ”。
现在,我想手动渲染我的按钮而不是使用FBML,因为它在移动设备上的速度太慢了“http://wiki.developers.facebook.com/index.php/Facebook_Connect_Login_Buttons#Facebook_Connect_for_iPhone_Buttons
如何关闭弹出窗口并重定向,使用此代码,如文档中所述?:
<a href="" onclick="FB.Connect.requireSession();return false;"><img src="http://wiki.developers.facebook.com/images/6/6f/Connect_iphone.png"></a>
答案 0 :(得分:1)
您希望在成功登录时运行的代码作为参数传递给requireSession()
。在你的情况下,我相信你想要
<a href="" onclick="FB.Connect.requireSession(function () {
window.location = '/custompage.html'
});return false;">
<img src="http://wiki.developers.facebook.com/images/6/6f/Connect_iphone.png">
</a>
答案 1 :(得分:0)
固定。 把它放在requireSession中:
function() { window.location='/'; }