Here is the code:
attachment = { message:'', name: 'post title', caption: 'user just did something',
link: 'post URL', action_links: [{ text: 'action link test', href: 'http://example.com'}]
};
FB.api('/me/feed', 'post', attachment, function(response) {
开发者_如何学编程 if (!response || response.error) {
alert('Error occured ' + response.error.message);
} else {
alert('Post ID: ' + response.id);
}
});
Any clues?
You put a string 'post URL' for the link
. link
has to be a properly formatted URL like http://stackoverflow.com/
.
Had same problem ... the issue was in the message (description) . i had an invalid URL. in my case i used a link to a non existing facebook page. it seems that facebook checks the validity of the page before linking it from the description. just check all your links before adding them in a posting description
i just fixed the url and every thing worked fine
精彩评论