2012-10-21 130 views
0

我已经在JavaScript中实现了facebook共享功能。到目前为止,当我点击时,弹出窗口显示文档的标题,URL和图像。我需要添加一个小说明像这样的:分享脸书的描述

enter image description here

到目前为止,我的代码是这样的:

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'); 

有什么事情要添加到使描述出现在共享资源弹出窗口?

回答

1

在你要共享的网页(http://xxxxx.com/myblog),你需要添加的FB的Open Graph标签

<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=""/> 

这个标签添加描述

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

阅读更多@http://developers.facebook.com/docs/opengraphprotocol/

+0

嗨,thanx为您的答复,似乎你提到的所有元标记是必需的,我可以管理它们,除了'fb:app_id',从哪里可以得到一个? – Malloc

+0

你有Facebook的粉丝页面,Facebook的应用程序或Facebook帐户?登录Facebook,然后去这个网址http://developers.facebook.com/docs/reference/plugins/like/它应该你你的'管理员ID'(FB:管理员或FB:APP_ID - 一个逗号分隔的列表Facebook的页面管理员或Facebook平台应用程序ID至少,只包括您自己的Facebook ID) –

+0

您可能还需要'清除Facebook共享缓存'之前,一些页面将工作,例如。 http://stackoverflow.com/questions/5256114/how-to-clear-facebook-sharer-cache –