0

I want to add a Facebook like button iframe in a div. Is there a way to check that whether the person have liked the page or not? Through this I want to set the behavior of the div. Means that if the page is already liked by the person then no div should appear, and if it is not, only then it should appear.

I found this. But I am not building an app. So can it work?

Community
  • 1
  • 1
SarmadK
  • 123
  • 1
  • 2
  • 14
  • [You may check this answer.](http://stackoverflow.com/questions/5972093/telling-if-someone-has-liked-my-facebook-page-from-my-website) – The Alpha Mar 03 '14 at 05:03
  • For a second I thought the title was *"Facebook lie detector"*. Was thinking something like `return Math.random() < .9` – Phil Mar 03 '14 at 06:01

1 Answers1

0

Update:

Checking if user has already liked a link

Checking if user has already liked a link is only possible when user has authorized you and you need an app to do so.

You can understand more about facebook authentication at facebook developers page https://developers.facebook.com/docs/facebook-login/getting-started-web/

After knowing that user is connected using facebook to your website, you can check the url_like table using query

SELECT user_id FROM url_like WHERE user_id = me() and url="Your_Page_URL"

A success response will mean that user has already liked your link.


Use iframeframe tracker jQuery plugin to detect when a user has cliked on Facebook Like iframe. You can assume that user has liked the page if a click happens inside the frame. https://github.com/finalclap/iframeTracker-jquery

And here is example with tracking facebook iframe http://www.finalclap.com/ressources/exemple/jquery-iframe-track/

Gaurav
  • 1,078
  • 2
  • 8
  • 18
  • But with this the div containing the frame will appear next time the user visit the page. I am looking for something that first checks the like and then behave accordingly. – SarmadK Mar 03 '14 at 05:39