我正试图在“forumeiros”(免费论坛)上的所有帖子上做一个Like按钮
当我在帖子上按“赞”时,它就像随机的所有帖子一样,对我来说没有任何意义
使用以下代码生成按钮:
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]+'&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=55" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:24px;" allowTransparency="true"></iframe><hr> ');
});
});
这里有两个生成的链接:
http%3A%2F%2Fgmbrdebug-t.forumeiros.com%2Ft2-teste-teste%2Ft2%2F
http%3A%2F%2Fgmbrdebug-t.forumeiros.com%2Ft2-teste-teste%2Ft3%2F
解码:(仅显示设置为facebook iframe的href属性)
http://gmbrdebug-t.forumeiros.com/t2-teste-teste/t2/
http://gmbrdebug-t.forumeiros.com/t2-teste-teste/t3/
那么,为什么当我首先按下“喜欢”时,以下所有“喜欢”呢?他们是不同的。
编辑:
所有网址都重定向到同一个地方,可能是吗?
如果是的话,Theres没办法做到这一点?
答案 0 :(得分:1)
如果生成的链接重定向到同一个地方,那么Facebook将它们视为相同的图形节点。这就是为什么喜欢一个会喜欢“全部”的人 - Facebook认为它们只是一件事。
您需要为每个帖子设置单独的链接,并将这些链接用于Facebook类按钮。