views:

132

answers:

2

I have facebook connect button on a page of my site and I want user to redirect to a page after a successful login: here's the code snippet:

</script>
<fb:login-button onlogin="facebook_onlogin();">
</fb:login-button> <script type="text/javascript">
FB.init("API_KEY", "http://myip/facebookapp/xd_reciver.html/"); 
function facebook_onlogin() {
    window.location="http://myip/facebookapp/mypage/"
} 
</script>

But when I logged in it redirects to the page INSIDE the pop-up, how can I redirect to the page out side of the popup..

+1  A: 

In my experience, this is generally caused by not having the cross-domain receiver file set up properly.

Assuming you copied the cross-domain receiver file that Facebook provides, then in your code snippet above, it looks like you misspelled "receiver" in xd_receiver.html. Double-check that it is a valid URL by copying and pasting it into your browser and making sure it can be loaded... my guess is you'll have to fix the spelling and remove the trailing slash, ie. http://myip/facebookapp/xd_receiver.html. Double-check the API key while you're at it, Facebook Connect can be quite frustrating to set up sometimes.

zombat
A: 

Are you using latest connect javascript sdk by facebook or the oldest one ? checkout the latest javascript sdk by facebook http://developers.facebook.com/docs/reference/javascript/

Here you'll see nice working example.

Mahmud Ahsan