Facebook共享链接 - 您可以自定义邮件正文吗?

tis*_*was 27 url facebook hyperlink

我正在尝试创建一个在Facebook上共享页面的链接.到目前为止我有:

href="http://www.facebook.com/sharer.php
?u=http%3A%2F%2Fwww.cnn.com%2F
&t=CNN%26s+website"
Run Code Online (Sandbox Code Playgroud)

但是,我真的想添加一些文字,这些文字会出现在"你的想法中?" 文本框(特别是当t链接标题覆盖该值时).有谁知道这是否可能?

ifa*_*our 50

注意: @ azure_ardee解决方案不再可行.Facebook不会允许开发者预先填写邮件.开发人员可以通过提供OG元标记来自定义故事,但是由用户来填充消息.

只有在代表用户发布时才需要这样做,这需要用户授权您的应用程序获得publish_actions权限.即使这样:

请注意,Facebook建议使用用户启动的共享模式.


看看这个答案.

  • 是的,Facebook API只是改变了一个怪人;)真的很难跟上. (6认同)

Ard*_*ram 39

无法使用sharer.php执行此操作,您可以使用Dialog API执行类似操作.http://developers.facebook.com/docs/reference/dialogs/

http://www.facebook.com/dialog/feed?  
app_id=123050457758183&  
link=http://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&  
name=Facebook%20Dialogs&  
caption=Reference%20Documentation& 
description=Dialogs%20provide%20a%20simple,%20consistent%20interface%20for%20applications%20to%20interact%20with%20users.&
message=Facebook%20Dialogs%20are%20so%20easy!&
redirect_uri=http://www.example.com/response
Run Code Online (Sandbox Code Playgroud)

Facebook对话框示例

问题是您必须创建一个虚拟Facebook应用程序才能获得app_id.请注意,您的Facebook应用程序根本不需要执行任何操作.请确保它已正确配置,您应该全部设置.

  • 不再以任何方式可行.查看他们的[平台政策,2.3](https://developers.facebook.com/policy/#control) (3认同)
  • 这仍然有效吗?原因是当我转到您的网址时,未设置该消息。 (2认同)

San*_*ain 37

在Facebook上分享最简单的方法是:https://www.facebook.com/sharer/sharer.php? u = xerosanyam.github.io"e
= You_are_amazing

奖励:
在Twitter上分享最简单的方式是:https://twitter.com/intent/tweet?from = xerosanyam&text = You_are_amazing

  • 这是不需要设置应用程序的正确答案。 (2认同)
  • 这不再有效。看起来 FB 已经更改了 URL 或阻止了它的使用 (2认同)
  • https://www.facebook.com/sharer/sharer.php?u=`用户名或网址`"e=`您的文字` (2认同)

Nic*_*ick 7

就像@Ardee所说,sharer.php使用meta标签中的数据,Dialog API接受参数.Facebook已经删除了使用message参数的功能,但你可以使用quote参数,这在很多情况下都很有用,例如

在此输入图像描述

https://www.facebook.com/dialog/share?
app_id=[your-app-id]
&display=popup
&title=This+is+the+title+parameter
&description=This+is+the+description+parameter
&quote=This+is+the+quote+parameter
&caption=This+is+the+caption+parameter
&href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F
&redirect_uri=https%3A%2F%2Fwww.[url-in-your-accepted-list].com
Run Code Online (Sandbox Code Playgroud)

只需要创建一个应用程序ID:

https://developers.facebook.com/docs/apps/register

然后确保重定向网址域列在该应用的接受域中.


Fgb*_*nch 5

要添加一些文本,这是我前一段时间做的,如果您共享的链接页面可以修改。您可以将一些元标记添加到共享页面:

<meta name="title" content="The title you want" />
<meta name="description" content="The text you want to insert " />
<link rel="image_src" href="A thumbnail you can show" / >
Run Code Online (Sandbox Code Playgroud)

这是一个小技巧。尽管旧的共享按钮已由“喜欢” /“推荐”按钮代替,但如果使用XFBML版本,则可以在其中添加注释。她的更多信息:

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


Rei*_*.85 5

就像文档中所说的那样,使用

<meta property="og:url"           content="http://www.your-domain.com/your-page.html" />
<meta property="og:type"          content="website" />
<meta property="og:title"         content="Your Website Title" />
<meta property="og:description"   content="Your description" />
<meta property="og:image"         content="http://www.your-domain.com/path/image.jpg" />
Run Code Online (Sandbox Code Playgroud)

推荐的图像尺寸:1 200 x 630