Html 如何通过类似于预填充推文的 URL 预填充 Facebook 状态消息?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9733154/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to pre-populate the Facebook status message through an URL similar to pre-populating a tweet?
提问by Crashalot
This question has been asked before on SO, but most of those questions were asked a long time ago.
之前在 SO 上已经问过这个问题,但大部分问题都是很久以前提出的。
Essentially, we want a simple way to pre-populate the Facebook status message through the URL much like you can with Twitter.
本质上,我们想要一种简单的方法来通过 URL 预填充 Facebook 状态消息,就像使用 Twitter 一样。
We're aware of the Facebook APIs, but are wondering if there is a more lightweight approach.
我们知道 Facebook API,但想知道是否有更轻量级的方法。
We don't need programmatically to post a message, but just provide some default text that the user can edit before sharing.
我们不需要以编程方式发布消息,而只需提供一些用户可以在共享之前编辑的默认文本。
采纳答案by J?rn Berkefeld
use the FB sharer - though it's supposed to be deprecated for a year or so it still works just fine. just add a link to a page or forward your user to this url (change the www.myDomain/path/ part):
使用 FB 共享器 -尽管它应该被弃用一年左右,但它仍然可以正常工作。只需添加指向页面的链接或将您的用户转发到此 url(更改 www.myDomain/path/ 部分):
Forward to:
转发:
http://www.facebook.com/sharer.php?src=sp&u=http%3A%2F%2Fwww.myDomain.com%2Fpath%2F
or add link like that:
或添加这样的链接:
<a href="http://www.facebook.com/sharer.php?src=sp&u=http%3A%2F%2Fwww.myDomain.com%2Fpath%2F">Share on FB</a>
be aware that all info that's presented for your page can be set via META tags which must be present on the page that was passed to the sharer.php. You canNOT change the title, image and description via some other variable
请注意,为您的页面显示的所有信息都可以通过 META 标记进行设置,这些标记必须存在于传递给 sharer.php 的页面上。您不能通过其他一些变量更改标题、图像和描述
that's about as lightweight as it gets - hope it helps
这就是轻量级的 - 希望它有所帮助
Update:see http://davidwalsh.name/facebook-meta-tagsfor a good tutorial on the meta tags
更新:有关元标记的好教程,请参阅http://davidwalsh.name/facebook-meta-tags
Update 2014-01:the API is no longer deprecated... lol
2014-01 更新:API 不再被弃用...大声笑
回答by covati
That actually violates the FB TOS:
这实际上违反了 FB TOS:
You must not pre-fill any of the fields associated with the following products, unless the user manually generated the content earlier in the workflow: Stream stories (user_message parameter for Facebook.streamPublish and FB.Connect.streamPublish, and message parameter for stream.publish), Photos (caption), Videos (description), Notes (title and content), Links (comment), and Jabber/XMPP. http://developers.facebook.com/policy/
您不得预先填写与以下产品关联的任何字段,除非用户在工作流程的早期手动生成内容:流故事(Facebook.streamPublish 和 FB.Connect.streamPublish 的 user_message 参数,以及流的消息参数。发布)、照片(标题)、视频(说明)、注释(标题和内容)、链接(评论)和 Jabber/XMPP。http://developers.facebook.com/policy/
Facebook doesn't want you to tell users what to say.
Facebook 不希望你告诉用户该说什么。
回答by Vijay
You can use the 'Message' property in either 'Feed dialog' or 'POST' method of GRAPH API.
您可以在 GRAPH API 的“Feed dialog”或“POST”方法中使用“Message”属性。
As you dont want to use much of code, you may use the Feed dialog and you can give the text whatever you want to populate in the 'Message' property.
由于您不想使用太多代码,您可以使用 Feed 对话框,并且您可以在“消息”属性中提供您想要填充的任何文本。
But remember you need the user_access_token for the message to be displayed.
但请记住,您需要 user_access_token 才能显示消息。
See the following links for information
有关信息,请参阅以下链接
https://developers.facebook.com/docs/reference/dialogs/feed/
http://developers.facebook.com/docs/reference/api/post/
https://developers.facebook.com/docs/reference/dialogs/feed/
http://developers.facebook.com/docs/reference/api/post/