Reputation: 117
I have a facebook sharer ..
window.fbAsyncInit = function() {
FB.init({appId: idApp , status: true, cookie: true, xfbml: true});
FB.Canvas.setSize({ height: 805 });
FB.Canvas.scrollTo(0,0);
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
function streamPublish(name){
FB.ui({
method: 'stream.share',
attachment: {
name:'Louis Dousset viens de t\'envoyer un message grâce à la Sweet Machine',
caption:'Caption',
description:"Desc",
"media": [{
"type": "mp3",
"src": $link,
"title": "",
"artist": "",
"album": "",
"href": ""
}]
},
display: 'page'
});
}
The following are the meta tags for the page
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<meta property="og:title" content="The Rock"/>
<meta property="og:url" content="http://www.yahoo.com"/>
<meta property="og:site_name" content="IMDb"/>
<meta property="fb:admins" content="USER_ID"/>
<meta property="og:description"
content="A group of U.S. Marines, under command of
a renegade general, take over Alcatraz and
threaten San Francisco Bay with biological
weapons."/>
</head>
<body>
<a href="#" onclick="showStream(); return false;"><img class="envoyer" src="images/btn_envoyer.png" alt="envoyer" title="envoyer" /></a>
</body>
</html>
However as I try to share the page, it does not retrieve the description text. It displays me a dialog with only the site url ..How can I retirve the meta tags' description and display it as the dialog description?
Upvotes: 0
Views: 287
Reputation: 43816
You should probably use Facebook's Send Button (or Like + Send) and rely on the meta tags on your side, the stream publish dialog allows you to override the title, description etc, and it's likely that in your case the parameters you're providing in the dialog are overriding the meta tags. Also, if those are the exact meta tags you're using, note that Facebook will follow the og:url tag to yahoo.com and read the metadata from there too.
Upvotes: 1