Obay
Obay

Reputation: 3205

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

I'm using FB.ui (https://developers.facebook.com/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?

Upvotes: 2

Views: 8115

Answers (2)

Jonas Äppelgran
Jonas Äppelgran

Reputation: 2747

You can use Open Graph Protocol.

Add this to your html tag: <html xmlns:og="http://opengraphprotocol.org/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.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"/>

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.

Upvotes: 1

zerkms
zerkms

Reputation: 255005

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

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

Upvotes: 7

Related Questions