问题
i have a like button and a log in button on the same page. the page is outside of a Facebook iframe. if i am not logged in and log in through the log in button the like button status doesn't get updated. but if i'm not logged in and log in via the like button the log in button gets updated. from what i can tell the like button doesn't seem to be able to receive the updates when window.fbAsyncInit is fired off.
is there a way to update the like button when i log in through a different Facebook button on the page?
回答1:
Here's a work-around.
Subscribing to the auth.statusChange
(http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/) and check to see if it is a sucessful login. If so, re-render the like button code into your DOM and then have the Javascript SDK re-parse it using FB.XFBL.parse()
(http://developers.facebook.com/docs/reference/javascript/FB.XFBML.parse/)
来源:https://stackoverflow.com/questions/10079956/facebook-like-button-status-update