views:

37

answers:

1

Hi, I am trying to run the basic fb connect example provided here

http://developers.facebook.com/docs/guides/web#login

Everything works fine except page does not gets refreshes after log in.

How can I achieve that?

+1  A: 

Looking at the guide there, the reload can be done in the JavaScript when you get the response that it has logged in. As such you can use the reload() in JavaScript:

window.location.reload()
gabe3886
I have added that code, but it looks like callback function doesnot get called. I tried putting a simple alert() but this is also not working.
Myth
Have you tried adding the alert into the else part of the call, so if you don't get response.session it will alert you?
gabe3886
Yea, tried that too. Really frustrated. It gets refreshed after first time authorization. But after that , it never gets refreshed automatically.
Myth
It could be that once you are logged in, when you go back it will know you are logged in (via a stored cookie) and therefore won't authenticate again. In the PHP file where it is checking that the cookie exists, you might want to redirect to another file from there (using `header("Location: page.php");`). Ultimately, if a page refreshes on login, and keeps refreshing on that page, it will only ever loop a refresh, nothing else.
gabe3886
Consider my authorization is completed previously. Then I logged out of facebook, clear cache, cookies etc (everything). Then I go back to the same page, Now when I click on login button again, It prompts me for a email and password, after providing that info and saying Login that window just vanishes. It should refresh the parent page and should show "Your Id is..". But thats not happening.
Myth
Unfortunately I'm now out of my depth on this one. I don't know much about programming stuff for Facebook, sorry.
gabe3886
Problem got resolved itself. Maybe problem was with facebook API. Thanks for the help.
Myth