Facebook Like button, can it be made read only?

。_饼干妹妹 提交于 2019-12-04 08:15:55

You can :

1) collect the number of likes through the facebook graph yourself, save them in a DB and then display it on your own without FB.

Example : http://graph.facebook.com/http://www.huffingtonpost.com/

Or better : http://graph.facebook.com/http%3A%2F%2Fwww.huffingtonpost.com%2F

Which returns :

{
   "id": "141265189223470",
   "name": "The Huffington Post - Breaking News and Opinion",
   "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/188056_141265189223470_1131566_s.jpg",
   "link": "http://www.huffingtonpost.com/",
   "category": "Personal blog",
   "likes": 15,
   "website": "http://www.huffingtonpost.com/",
   "description": "Breaking News and Opinion"
}

And thus "likes": 15,

For some ressources you will need an access token and url encode your url if necessary, as it could lead to problems with complex urls.

2) Display the like button in iframe version and put another div on top so that user cannot interact with it, but I wouldn't recommend that as It might frustrate your user when he will try to like. (Users are accustomed to the fact that they can click on this)

I guess a third option would be to fetch the number of like in Javascript on the client each time your display the page also using the graph api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!