Share title, description and image on Facebook

The following code will help you share custom details to facebook page.

link : Use the url to be shared in facebook so that clicking on the url will take the user to the intended page.
picture : Image to be shared.
name : title of the facebook share.
description : Description of the content to be shared.

<script>
var feedObj = {
    method: 'feed',
    link: 'http://blog.roymj.co.in/',
    picture: 'http://stackoverflow.com/users/flair/1046934.png',
    name: 'name',
    caption: 'caption',
    description: 'description',
    actions: [
        { name: 'text', link: 'http://blog.roymj.co.in/' }
    ]
};
function callback(response) {
alert('callback');
    if(response){
    }
}
FB.ui(feedObj, callback);
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *