Multiple likes refering different facebook pages

119 Views Asked by At

So i have an HTML page that lists facebook pages corresponding to a certain theme the user entered, beside each page there is a like button.

The problem happends when i load my page while disconnected from facebook, in that case when i click a like button i get a popup asking me to signin on facebook, after i do im able to like/unlike only that facebook page (the like button i first clicked), if i click on other buttons i get a blank popup and nothing happends.

Is this behaviour normal and is there any fix i could try for this?

EDIT:

Here are 2 demo pages i found showing the same problem.

To reproduce the bug, try to load any of those 2 pages when not connected on facebook, then try to click a like button, you will be prompted to log in and the clicked button will be functionnal but when clicking another button you'll have a blank page!

http://hillarsaare.com/projects/facebook/multi-like/

http://facebook-multiple-like.herokuapp.com/

1

There are 1 best solutions below

1
On

The like buttons don't become aware of the user login when it occurs (apart from the like button that triggered the login), they don't update their state after loading initially

To work around this you can remove the like buttons with Javascript when you detect the user has logged in (via the auth.statusChange javascript event in the Facebook JS SDK), then re-add the <fb:like elements and call FB.XFBML.parse to re-initialise the like buttons, which will then be aware of the logged-in state