简体   繁体   中英

Facebook like button liking too much

I'm trying to do a Like button on all posts on "forumeiros" (free forum)
When I press "Like" on a post it like all next posts randomly, does not make any sense for me
Using the following code to generate buttons:

jQuery(document).ready(function() {
    var url = new Array();
    var link = '';
    jQuery('.postbody .topic-title a[name]').each(function(index){
        link = "http://"+document.domain+jQuery(this).attr("href")+"/";
        link = link.replace('#', '/t');
        url.push(link);
    });
    jQuery('p.author').each(function(index){
        jQuery(this).after('<iframe src="http://www.facebook.com/plugins/like.php?href='+url[index]+'&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=55" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:24px;" allowTransparency="true"></iframe><hr> ');
    });
});

Here two generated links:
http%3A%2F%2Fgmbrdebug-t.forumeiros.com%2Ft2-teste-teste%2Ft2%2F
http%3A%2F%2Fgmbrdebug-t.forumeiros.com%2Ft2-teste-teste%2Ft3%2F

Decoded: (Only showing href attribute set to facebook iframe)

http://gmbrdebug-t.forumeiros.com/t2-teste-teste/t2/
http://gmbrdebug-t.forumeiros.com/t2-teste-teste/t3/

So, why when I press "like" on first all following are "liked" too? they are different.

EDIT: All url redirect to the same place, may be it?
If yes, Theres no way to do it?

If the generated links redirect to the same place then Facebook sees them as the same graph node. That's why liking one will like "all" of them - Facebook sees them as only one thing.

What you need is to have separate links for each post, and use those links for the Facebook like buttons.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM