Anyway, here's a small JS snippet on how to post to a user's wall. The user must first allow the application pushing rights, or an error will occur.
I have already written a great blog entry on getting started with Facebook Connect, check it out here!
Pre-requisites
- Check out the above link if you have no idea how to get started!
- Allow pushing rights (publish_stream)
- Ensure your already dealing with an authentication session (I have added the code to ensure you already have a valid session in the code below)
Javascript Code
FB.getLoginStatus(function (response) {
if (response.session) {
var params = {};
params['message'] = 'This is the main message';
params['name'] = 'This is the name of the link';
params['description'] = 'This is the link description';
params['link'] = 'http://www.URLToNavigateTo.com';
params['picture'] = 'http://www.FULLpathtoimage.com/image.png'; // 90x90 px
params['caption'] = 'Small caption appearing under the link';
FB.api('/me/feed', 'post', params, function (response) {
if (!response || response.error) {
// Error occured posting to the fb wall
}
});
} else {
// User isn't authenticated with facebook
}
});
This will produce the following result...
4 comments:
fooollllllllllllllllllllllllllllll
Can you plz Elaborate More
your reply will be highly appreciated in this regards
Can you plz Elaborate More
your reply will be highly appreciated in this regards
emmmmmmmmmm
Post a Comment