Facebook Like button, can it be made read only?

别等时光非礼了梦想. 提交于 2020-01-13 01:54:06

问题


I'm using Facebook Likes in my site. I have a gallery page which shows picture/video data and the number of likes for that data. Each piece of data has it's own URL which can be liked.

However, I want to display the number of likes in the gallery navigation, but I don't want people to be able to "like" from the navigation. Is there a way to display the number of likes without the button?

The only way I've seen so far is using the link stat "table" from FQL: http://developers.facebook.com/docs/reference/fql/link_stat/

Is there an easier way because this seems like a fair amount of work to implement.


回答1:


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



来源:https://stackoverflow.com/questions/6020720/facebook-like-button-can-it-be-made-read-only

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