最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Add a predefined message to a Facebook "Post to Your Wall" dialog using FB.ui - Stack Overflow

programmeradmin1浏览0评论

I'm using FB.ui (.ui/) to create the "Post to Your Wall" feature on my website:

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);

How do I add a predefined message to the post, e.g. "Check out this link, guys!"

I've tried adding the message parameter to the new_post object, but that doesn't seem to work.

When the dialog is shown, focus is on the text box, with Say something about this... instead of the Check out this link, guys! message.

Any suggestions?

I'm using FB.ui (https://developers.facebook./docs/reference/javascript/FB.ui/) to create the "Post to Your Wall" feature on my website:

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);

How do I add a predefined message to the post, e.g. "Check out this link, guys!"

I've tried adding the message parameter to the new_post object, but that doesn't seem to work.

When the dialog is shown, focus is on the text box, with Say something about this... instead of the Check out this link, guys! message.

Any suggestions?

Share Improve this question edited Apr 24, 2012 at 2:48 steveax 17.7k6 gold badges46 silver badges59 bronze badges asked Apr 24, 2012 at 2:11 ObayObay 3,20516 gold badges57 silver badges80 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

It has been removed from FB API since Jan 1st, 2012 and pletely removed after July 5th, 2012. see http://developers.facebook./docs/fbjs/

So nowadays you cannot specify the text of the message in any way.

You can use Open Graph Protocol.

Add this to your html tag: <html xmlns:og="http://opengraphprotocol/schema/">

And include this in your <head> tag.

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

If you want multiple messages for the same url you can use ?something and if isset($_GET['something']) then change the og tags as you wish.

发布评论

评论列表(0)

  1. 暂无评论