javascript - How to close the Facebook pop-up login window after the user Connects? - Stack Overflow

Below is my code. For some reason, after the user logs into the little pop-up window, the little window

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=".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>

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./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>
Share Improve this question edited Oct 22, 2009 at 23:06 TIMEX asked Oct 22, 2009 at 22:22 TIMEXTIMEX 273k368 gold badges802 silver badges1.1k bronze badges 2
  • Can anyone help me with this? – TIMEX Commented Oct 23, 2009 at 0:59
  • If anyone is having this problem in June 2011, FB recently introduced a bug which stops the window closing in IE 7, 8 & 9. See here: bugs.developers.facebook/show_bug.cgi?id=18405 – tonyhb Commented Jun 17, 2011 at 14:33
Add a ment  | 

6 Answers 6

Reset to default 3

I just solved a similar issue, that when you login with the Facebook login popup window, and it closes, the page didn't refresh.

My Facebook APP wasn't properly configured. Just go to your application settings in Facebook and specify the correct Site URL (under the Web Site section). If you are testing it locally you can put http://localhost/

Hope this helps!

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./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!

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 munity with facebook connect, you can read it here.

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);
                                  ^

My popup wasn't closing (when posting to a feed) because I didn't have the channel.html file in the right place. After doing the post it redirects to the channel.html file in order (partly) to close the popup - so not having it in the right place meant it didn't close.

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745320085a4622403.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信