简体   繁体   English

如何将Facebook与自己的“赞”按钮集成

[英]How Can I Integrate Facebook With My Own Like Button

I have a like button on my own website, and I want it to function just like it currently does, with the additional feature that it also makes a post on the person's facebook timeline "John Smith liked this post on www.example.com" where www.example.com is my website. 我在自己的网站上有一个“喜欢”按钮,我希望它能像当前一样运行,并具有一个附加功能,即它还在该人的Facebook时间轴上发布了一个帖子“约翰·史密斯在www.example.com上喜欢了这篇文章”其中www.example.com是我的网站。 How can this be achieved? 如何做到这一点?

Facebook has documentation for how to put their own like button but I don't want theirs, I just want what I already have to have that one functionality. Facebook上有关于如何放置自己的“喜欢”按钮的文档,但是我不想要他们的按钮,我只是想要拥有该功能的东西。

First of all, you are not allowed to use custom graphics for the Like Button, you MUST use their own one. 首先,不允许您为“赞”按钮使用自定义图形,您必须使用自己的图形。

You can use og.likes to create your own Like Button: https://developers.facebook.com/docs/reference/opengraph/action-type/og.likes 您可以使用og.likes创建自己的“赞”按钮: https : //developers.facebook.com/docs/reference/opengraph/action-type/og.likes

A message about the User having liked something shows up automatically on Facebook, you can't "autopost" it additionally. 关于用户已喜欢某事的消息会自动显示在Facebook上,您不能再对其进行“自动发布”。 It would require to authorize a User with the publish_actions permission, and it will definitely not get approved by Facebook because the message parameter must be 100% User generated: 这将需要授权具有publish_actions权限的用户,并且它肯定不会得到Facebook的批准,因为message参数必须是100%用户生成的:

Don't prefill captions, comments, messages, or the user message parameter of posts with content a person didn't create, even if the person can edit or remove the content before sharing. 不要用一个人未创建的内容预填充标题,评论,消息或用户消息参数,即使该人可以在共享前编辑或删除内容。

Source: https://developers.facebook.com/policy/ 资料来源: https : //developers.facebook.com/policy/

If you know how to put their button on your page, you should also know how to put your own button on your page. 如果您知道如何在页面上放置他们的按钮,那么您还应该知道如何在页面上放置自己的按钮。 It should be as easy as changing code between 它应该像在

<a href...> 

and

</a>

I just googled 2 min and came up with this: 我只是用谷歌搜索了2分钟,想出了这个:

https://developers.facebook.com/docs/plugins/like-button

It says: Use this URL in an iframe or as a link to your plugin. 它说:在iframe或插件链接中使用此URL。

http://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fyoururl.com&width&layout=standard&action=like&show_faces=true&share=true&height=80

Just change yoururl.com to whatever it should like. 只需将yoururl.com更改为所需的内容即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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