How to check if a user likes my Facebook Page or URL using Facebook's API

后端 未结 5 1116
囚心锁ツ
囚心锁ツ 2020-11-22 02:37

I think I\'m going crazy. I can\'t get it to work.
I simply want to check if a user has liked my page with javascript in an iFrame app.

FB.a         


        
5条回答
  •  独厮守ぢ
    2020-11-22 03:36

    You can do it in JavaScript like so (Building off of @dwarfy's response to a similar question):

    
      
        
        
      
      
        
    YOU DON'T LIKE ME :(
    YOU LIKE ME :)

    Where the channel.html file on your server just contains the line:

     
    

    There is a little code duplication in there, but you get the idea. This will pop up a login dialog the first time the user visits the page (which isn't exactly ideal, but works). On subsequent visits nothing should pop up though.

提交回复
热议问题