views:

378

answers:

2
<fb:login-button onlogin="window.location = '/custompage.html';">Connect</fb:login-button>

That's currently my code for users to log in to my site. It's in FBML.

It will pop up a box, the user then logs in. And then, it closes the new window, followed by a redirect to "custompage.html".

Now, I would like to manually render my button instead of using FBML, because it's too slow on mobile" http://wiki.developers.facebook.com/index.php/Facebook_Connect_Login_Buttons#Facebook_Connect_for_iPhone_Buttons

How do I close the popup window and redirect, using this code as explained in the doc?:

<a href="" onclick="FB.Connect.requireSession();return false;"><img src="http://wiki.developers.facebook.com/images/6/6f/Connect_iphone.png"&gt;&lt;/a&gt;
A: 

Fixed. put this inside the requireSession:

function() { window.location='/'; }
TIMEX
+1  A: 

The code you want run on successful login should be passed as an argument to requireSession(). In your case, I believe you want

<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"&gt;
</a>
brahn