views:

1438

answers:

8

Below is my code. For some reason, after the user logs into the little pop-up window, the little window will redirect back to '/" with a lot of session JSON junk at the end of the URL.

How do I make it so that the little window closes, and my parent window refreshes?

<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script>

<fb:login-button v="2" onlogin='window.location("/test");' size="medium">Connect</fb:login-button>
<script type="text/javascript">FB.init("XXXXX",'/xd_receiver.htm');</script>
+1  A: 

It looks like you have a random 'h' in your code. Could this be messing with the JS functionality?

FB.init("XXXXX",'/xd_receiver.htm'h);
                                  ^
Matt Huggins
that's not the bug., thanks though :)
TIMEX
A: 

You can use the onlogin attribute this way:

onlogin="document.location.href=document.location.href;"

This will be executed by the opener (refreshing the page).
If you remove the onlogin attribute the pop up will also close, but the page below do not refresh.

I wrote a tutorial about integrating a community with facebook connect, you can read it here.

Pons
A: 

Alex, did you ever get this resolved? I'm having the same issue.

Midwire
A: 

Page Reloading

Try setting the reloadIfSessionStateChanged flag for FB.init. For example,

FB.init(  "myAPIkey", 
          "path/to/xd_receiver.htm",
          {"reloadIfSessionStateChanged": true}
       );

From the Facebook API

reloadIfSessionStateChanged

bool - If the value is true, Facebook will monitor changes in session state and reload the current page if the session state changes. This option is convenient for an implementation that needs to reload the page whenever session state change in order to generate different content from server side.

For more info check out http://developers.facebook.com/docs/?u=facebook.jslib.FB.Facebook.init

Popup Not Closing

I've found that you may have issues with your popup window not closing if your path/to/xd_receiver.html is incorrect, or if your onlogin function for your Connect Button is undefined, so be sure to double check those.

Hope that helps!

flickerfade
A: 

I solved it. It was to do with my settings in FAcebook's page.

TIMEX
A: 

TIMEX, you said you figured out the issue - I'm getting this same problem, what was it you changed/fixed on your settings page to get this to work? Thanks!

Johnny
A: 

Yeah, how did you solve this? I'm having the same problem as well...

Bazze
change settings in facebook settings page
TIMEX