如何“喜欢” facebook内容外部 [英] How to "Like" facebook content externally

查看:99
本文介绍了如何“喜欢” facebook内容外部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我一直在玩像facebook一样的按钮,但我遇到了一个问题。我有一个关于我在这里做的一些慈善工作的facebook页面:

So I have been playing around with the facebook like button but I have run into a problem. I have a facebook page about some charity work I'm doing here:

http://www.facebook.com/Adam.Holmes.Climbs.Kilimanjaro

我还有一个网页上有相同的信息。在这个网页中,我有一个类似Facebook的按钮,以便用户可以像这里看到的页面一样:

I also have a web page that has pretty much the same information on it. Within this web page I have a facebook like button so that users can like the page as seen here:

http://developers.facebook.com/docs/reference/plugins/like/

现在我的问题是单独的按钮。在Facebook页面中,我添加了一些用户已经喜欢和评论等的图像。我现在已经在我的网页上放置了相同的图像,我想为每个图像添加一个类似Facebook的按钮,从而显示所有喜欢的内容图片在facebook上有。我已将许多不同的链接插入到类似按钮中,但它们似乎都不起作用。我试过a)页面的网址。 b)图像的网址。 c)随机位和蝙蝠操纵不同的网址。

Now my issue is with a seperate button. Within the facebook page I have added images of which some users have "liked" and commented etc. I have now placed those same images on my web page where I would like to add a facebook like button for each image and hence displaying all the likes that the image has on facebook. I have plugged many different links into the like button but none of them seem to work. I have tried a) the url of the page. b) the url of the image. c) random bits and bats manipulating different url's.

我试图查看javascript源代码,但这对我的理解来说太复杂了。我知道从按钮调用函数fc_click()进一步调用另一个函数,不久之后我就迷路了,并且没有找到使用的url。

I attempted to look through the javascript source code but it is much too complicated for my understanding. I know that a function fc_click() is called from the button which further calls another function, and not long after that I get lost, and have not found what url is used.

所以我想我的问题是,在喜欢脚本中放置的url是什么,以便我可以在facebook外部使用like按钮?

So I guess my question is, what is the url to be placed in the "like" script so that I can use the like button externally to facebook?

如果我需要更多信息,请说明。

If anymore info is needed, please say so.

非常感谢:)

更新:我一直在尝试所有不同的组合或网址,但仍然没有运气。其中一个喜欢按钮的对象是图形中的对象,即这是我想要的对象。但没有这些链接正在发挥作用。也许facebook限制了这一点,因为它很容易使用页面的网址,它工作正常,只是不是单个项目。

UPDATE: I have been trying all different combination's or URL's and still having no luck. The object for one of the "Like" buttons is an object in the graph i.e. Here is the object I want to like. but none of these links are working. Maybe facebook are restricting this as it is simple to use the url of the page and it works fine, just not individual items.

我可以再次添加我需要放置在标签中的链接,而不仅仅是为了能够检索喜欢和评论等的计数。我还在facebook开发者论坛这里开始了一个主题,但没有人回复过一个解决方案。

May I add again that I need the link that is to be placed in the tag and not just to be able to retrieve a count of the likes and comments etc. I also started a topic on the facebook developer forums here but no-one has replied with a solution.

再次感谢。

更新2:
正如Myles Gray所指出的,代码实际上在HTML中呈现为:

UPDATE 2: As pointed out by "Myles Gray" the code is actually rendered in the HTML as:

< label onclick =this.form.like.click();>

我不确定是否有办法访问来自外部页面的表单将没有正确的引用。是否有人能够阐明是否可以做到这一点,如果可以的话,怎么做?当然,如果可以这样做,正确引用这个将允许我在外部喜欢内容。

I'm not sure if there is a way to access the form from an external page since is wouldn't have the correct this reference. Is anybody able to shed some light on whether this can be done, and if so, how? Surely if this can be done, having the correct reference to this would allow me to like content externally.

推荐答案

我担心你想要的是 。快速证据

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:like href="http://www.facebook.com/platform" show_faces="true" width="450"></fb:like>

这可以正常工作,但使用其图谱API解释:

This would work just fine, but using its Graph API interpretation:

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:like href="https://graph.facebook.com/19292868552" show_faces="true" width="450"></fb:like>

这不起作用!

我认为您不应该费心寻找变通方法/黑客或尝试检查和调试Facebook上的照片页面,因为 EVEN 如果您确实找到了一种方法来在外部使用类似的功能,我很确定会让您陷入Facebook的法律问题!

I don't think you should bother searching for a "workaround/hack" or trying to inspect and debug the photo page on facebook, because EVEN if you did find a way to use their like functionality externally I'm pretty sure that would get you into legal issues with Facebook!

现在我要做的是,监控用户喜欢你网站上的照片并弹出一个或DIV在LIKE按钮下鼓励他去Facebook的照片页面支持它(就像它)!

Now what I would do is, monitoring when the user "likes" a photo on your website and have a pop-up or a DIV under the LIKE button to encourage him to go the photo page in Facebook to support it (like it) there too!

这可以通过使用 edge.create 事件来完成:

This can be done by using the edge.create event:

FB.Event.subscribe('edge.create', function(response) {
  // Encourage the user to support your cause in Facebook too!
  $("div_with_a_link_to_the_photo_page_on_facebook").show();

  // or using a dialog or whatever effect you like
  $("#facebook_support").dialog();
});

PS:我在这里使用jQuery

另外要真正喜欢外部的facebook对象,你需要一个应用程序,比如我的回答这里,但我想你不想这样做。

Also to actually like facebook "objects" externally you need an application and something like my answer here, but I think you don't want to do that.

这篇关于如何“喜欢” facebook内容外部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆