Search code examples
javascriptfacebookfacebook-graph-apifacebook-likefacebook-javascript-sdk

Check if a Facebook user likes a specific page and display content


I've searched all over the Internet and tried different ways to check if an user likes a specific page but I haven't get it done. My code is from here: http://fiddle.jshell.net/X4bn6/1042/ I think the problem is with my app. It returns me a wrong user ID (different from that generated by: http://graph.facebook.com/username) My app website and domains are correctly filled.

Anyone know what could be the problem? Or have a solution which doesn't need a facebook app?

I'll really appreciate your help.


Solution

  • First thing to check, are you asking for user_likes permissions?

    Second, you can replace your FQL by:

    var fql_query = "SELECT uid FROM page_fan WHERE page_id = "+page_id+" AND uid= me()";
    

    I hope it helps.

    Cheers,