AddThis:Facebook共享忽略共享配置

问题描述:

我想动态地添加一个AddThis工具箱。 Twitter &电子邮件接收来自共享配置文件的一些变量,但Facebook共享从那里没有得到任何信息。AddThis:Facebook共享忽略共享配置

我错过了什么?

HTML:

<span class="toolbox1 addthis_toolbox"> 
    <a class="addthis_button_facebook"></a> 
    <a class="addthis_button_twitter"></a> 
    <a class="addthis_button_linkedin"></a> 
    <a class="addthis_button_email"></a> 
</span> 

JS:

toolbox_obj = $('.toolbox1').get(0); 
addthis.toolbox(toolbox_obj,sharing_config,{title: 'aaa'}); 

你可以试试这个

HTML

<span class="toolbox1 addthis_toolbox"></span>​ 

JS

var tbx = $(".toolbox1").get(0), 
svcs = {facebook: 'Facebook', twitter: 'Twitter', linkedin:'Linkedin', email: 'Email'}; 
$.each(svcs, function(k, v){ 
    $('<a></a>', { class:'addthis_button_'+k }).appendTo(tbx); 
}); 

Working Example Here.

+0

我可能不清楚.. Facebook按钮出现。但是当我分享时,它不会从共享配置对象('{title:'aaa'}')分享标题名称。 – Miki

书面上AddThis documentation

一些服务,最值得注意的是Facebook和LinkedIn,不使用 参数我们发送给他们。相反,他们使用元标记来确定要共享的URL,标题和描述。

某些服务(例如Facebook和Linkedin)只是忽略这些配置信息,因为从Open Graph元标记中获取数据。所以你应该添加Open Graph元标记到你的HTML中(尝试阅读this useful resource),如果你遇到AJAX加载内容的一些问题,也许你可以通过强制url通过特定的addthis方法来解决(显然是在新内容之后已被加载):

addthis.update('share', 'url', window.location.href); // re-parse the url 
addthis.ready(); // re-render the buttons. 

现在,通过Facebook共享将从页面中打开的图元标记正确获取其数据。

这是一个很好的资源,以解决我面临了类似的问题:

AddThis buttons wont update to include fragment (#Hash Tag)

希望这可以帮助,再见!

<HEAD> 
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> 
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script> 

<meta property="og:title" content="Your Title" /> 
<meta property="og:type" content="website" /> 
<meta property="og:image" content="Your Thumbnail Image Link" /> 
<meta property="og:url" content="Your URL" /> 
<meta name="description" content="Your Description" /> 

<HEAD> 


<a name="fb_share" type="button_count" href="http://www.facebook.com/sharer.php">Share</a> 
+0

结果将会是: http://4.bp.blogspot.com/-sV8ulEsNnSE/TdizQQPgNXI/AAAAAAAAAD4/JElqfUuGf60/s400/fb-share.jpg – xr0x