开发者

Facebook LIKE button hiding when page is already LIKED by user

开发者 https://www.devze.com 2023-01-06 06:21 出处:网络
I\'m trying to create a page on my site where the Like button should be hidden if the user already likes the page.If I can\'t hide it, then maybe there\'s a way to get a callback when the like button

I'm trying to create a page on my site where the Like button should be hidden if the user already likes the page. If I can't hide it, then maybe there's a way to get a callback when the like button is rendered with a user who already likes the page. This way I can hide/revea开发者_Go百科l the iframe myself.

Any clues?

Howie


Assuming you can echo the ids of the like buttons to the page for the likes you want hidden/get from a JSON call.

var hideLikes = ["#like1", "#like2", "#like3", "#like4", "#like5"]; 
var hideLikesSelector = hideLikes.join(",");
$(hideLikesSelector).hide();


You should not hide the Like button as you're suggesting. It is against Facebook policy to hide it after the user has liked the thing in question, you should give them the opportunity to unlike it if they chose to do so.


@Graphain, why are you commenting? You have no valid input.

@Others, I have been trying this too and had it working by looking at the opacity of certain tag's classes but it no longer works again. You can make an api call to /me/likes and go through the returned array to look at each name or id...

Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消