使用FB.ui将预定义的消息添加到Facebook的“发布到您的墙”对话框中

Add a predefined message to a Facebook "Post to Your Wall" dialog using FB.ui

本文关键字:对话框 Facebook 预定义 FB 消息 使用 添加 ui      更新时间:2023-09-26

我正在使用FB.ui(https://developers.facebook.com/docs/reference/javascript/FB.ui/)在我的网站上创建"发布到你的墙"功能:

var new_post = {
    method: 'feed',
    link: '/path/to/my/site',
    picture: '/path/to/image.jpg',
    name: 'My Site',
    caption: 'Lorem',
    description: 'Ipsum',
    message: 'Check out this link, guys!' //this does not work
};
FB.ui(new_post, callback_defined_somewhere);

如何在帖子中添加预定义的消息,例如"看看这个链接,伙计们!

我尝试将 message 参数添加到 new_post 对象,但这似乎不起作用。

显示对话框时,焦点位于文本框上,Say something about this...而不是Check out this link, guys!消息。

有什么建议吗?

自 2012 年 1 月 1 日起,它已从 FB API 中删除,并在 2012 年 7 月 5 日之后完全删除。 见 http://developers.facebook.com/docs/fbjs/

因此,如今您无法以任何方式指定消息的文本。

您可以使用开放图形协议。

将此添加到您的 html 标记中:<html xmlns:og="http://opengraphprotocol.org/schema/">

并将其包含在您的<head>标签中。

<meta property="og:title" content="Link title text!"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://example.com/"/>
<meta property="og:site_name" content="Link title text!"/>
<meta property="og:description" content="Link description text!"/>
<meta property="og:image" content="http://example.com/fbshare.png"/>

如果您希望同一 url 有多个消息,您可以使用?something,如果是isset($_GET['something']),则可以根据需要更改 og 标签。