Virendra Singh Virendra Singh - 1 year ago 155
jQuery Question

how to get if person is already liked fb page or not using javascript sdk

I intergrate like button in my website. After login with facebook, now if any one already liked fb page directly from facebook then some fields will be shown to user otherwise fields will be hidden. I already put function for above thing and it works for me but not for others. Don't know why?
Here is a function which contains fb like thing and triggered on button click

function getUserDetail(){

FB.api("me/likes/242500342443159", function(response) {
if ( == 1 ) {
console.log('You like it');
} else {
console.log("You don't like it");

and i also took user_likes permission on login.
Please correct me if i am doing any mistake in above function.

Answer Source

IMPORTANT: You are not allowed to hide/gate content behind a like or incentivize liking a Page in any way. you must read the platform policy before creating any App:

That being said, you would need user_likes for that API call, which needs to get reviewed by Facebook before everyone can use it. Without review, only users with a role in the App are able to authorize that permission. It is called Login Review:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download