Search code examples
javascriptfacebook-sharer

Share facebook with a description


I have implemented the facebook share feature in JavaScript. So far, when i click, a popup show up with the title of the document, the url and an image. I need to add a small description like this one:

enter image description here

So far, my code is this:

window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent('http://xxxxx.com/myblog')+'&t='+encodeURIComponent(''),'sharer','toolbar=0,status=0,width=626,height=436'); 

Is there any thing to add to make the description appear on the sharer popup window?


Solution

  • On the page you want to share (http://xxxxx.com/myblog) you need to add the FB Open Graph Tags

    <meta property="og:url" content=""/>
    <meta property="og:type" content="article"/>
    <meta property="og:title" content=""/>
    <meta property="og:image" content=""/>
    <meta property="fb:app_id" content=""/>
    

    This tag add the description

    <meta property="og:description" content="xyz">
    

    Read more @ http://developers.facebook.com/docs/opengraphprotocol/