How to close Facebook login popup after connecting user?

Below is my code. For some reason, after the user enters a small popup, the small window will be redirected back to '/' with a lot of unwanted JSON session at the end of the URL.

How do I make a small window close and my parent window is updated?

<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> 
+3
source share
6 answers

I solved it. This is due to my settings on the FAcebook page.

-7
source

I just solved a similar problem that when you enter the Facebook login window and it closes, the page did not refresh.

My Facebook APP is not configured correctly. Just go to the settings of your application on Facebook and specify the correct website URL (in the "Website" section). If you are testing it locally, you can put http: // localhost /

Hope this helps!

+3
source

Page reload

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

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

From Facebook API

reloadIfSessionStateChanged

bool - If the value is true, Facebook will follow the changes in the session state and reload the current page if the session state changes. This parameter is convenient for implementation, which requires reloading the page whenever the session state changes to generate various content from the server side.

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

Popup does not close

I found that you may have problems with a popup that doesn't close if your path/to/xd_receiver.html incorrect, or if your onlogin function for your connect button is undefined, so be sure to double check them.

Hope this helps!

+2
source

You can use the onlogin attribute as follows:

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

This will be done by the opener (page refresh).
If you remove the onlogin attribute, the popup will also close, but the page below will not refresh.

I wrote a tutorial on community integration with a connection to facebook, you can read it here .

+1
source

It looks like you have a random "h" in your code. Could this mess with JS functionality?

 FB.init("XXXXX",'/xd_receiver.htm'h); ^ 
0
source

My popup did not close (when sending to the channel) because I did not have the channel.html file in the right place. After the message is executed, it is redirected to the channel.html file in order (partially) to close the pop-up window - therefore, not having it in the right place means that it does not close.

0
source

All Articles