Facebook Integration Part 1 – Share to Timeline
Sharing to the time line is actually pretty easy.
First you need to register your app with Facebook. For this you will need some information and graphics.
First login to facebook and goto to: https://developers.facebook.com/apps
And create a new app. You will need the domain you are hosting the app on as well as some icons and banner images.
Icons: 16×16, 75×75, 128×128
Web Banner 150×100
Cover image: 800×150
You will also need to select how the app intergrates, usually Mobile is fine for a web app.
Once the app is created you really just need the App ID.
In Mobione add the following url as a new javascript library in the main settings.
htp://connect.facebook.net/en_US/all.js
Once that is loaded select the item you want to activate the share, button or image.
On the item make the On Click action Run Javascript.
Select the following and enter it in the code area and add your information
//Initialize
FB.init({appId: "YOUR_APP_ID", status: true, cookie: true});
// calling the API ...
var obj = {
method: 'feed',
//URL to your app
redirect_uri: 'http://yourapp.com/url',
link: 'http://yourapp.com/url',
//for icon image, you can delete
picture: 'http://yourapp.com/urlimages/object.png',
name: 'Your Title for the post',
caption: 'Caption under the title',
description: 'description of the post'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
You should now be able to run it and share the link you included.