Check If User Liked Page Or Not
I have read a lot of related topics here regarding this problem but I am still not able to do something like this http://www.facebook.com/Dominos/app_252492331452398 Below is the c
Solution 1:
You can do this in a programmatic way as well, not necessarily just in the context of a tab.
Note that it will require you to ask for the "user_likes" permission from the user in your O-Auth connect dialog.
This code snippet will test for whether someone currently likes something or not:
FB.api('/me/likes/MY_PAGE_ID', {limit: 1}, function(r) {
if (r.data.length == 1) {
//do stuff when the user is a liker
} else {
//do stuff when the user is not currently a liker
}
});
If you want to catch the event when the user clicks the like button, then you can use FB.Event.subscribe:
FB.Event.subscribe('edge.create',
function(response) {
//Do stuff when the user just clicked a "like" button
}
);
Solution 2:
On a Facebook fan page, when the user clicks the Like button, the whole page gets reloaded and Facebook sends an HTTP post to your website with a parameter called signed_request that you would need to decode and look at with server code. Signed Request is documented here. Once decoded, you will need to look at the page.liked value.
Might be helpful:
Post a Comment for "Check If User Liked Page Or Not"