在每个社交网站上通过 AddThis 插件分享图片和描述的问题

Issue with sharing image and description via AddThis plugin in every social site

这是我的代码:

$('#sharethis').attr('addthis:url', "<?php echo base_url(); ?>" + "research_science/Details/" + returnedData.research_id);
$('#sharethis').attr('addthis:title', returnedData.research_name);
$('#sharethis').attr('addthis:description', returnedData.research_desc);
$('#sharethis').attr('addthis:media', "<?php echo base_url(); ?>" + returnedData.research_logo);

addthis.update('share', 'url', "<?php echo base_url(); ?>" + "research_science/Details/" + returnedData.research_id);
addthis.update('share', 'title', returnedData.research_name);
addthis.update('share', 'description', returnedData.research_desc);
addthis.update('share', 'media', "<?php echo base_url(); ?>" + returnedData.research_logo);
addthis.update('share', 'url', "<?php echo base_url(); ?>" + "research_science/Details/" + returnedData.research_id);

$(".addthis_toolbox .addthis_counter").replaceWith('<a class="addthis_counter addthis_bubble_style"></a>');
addthis.counter('.addthis_counter', null, {url: "<?php echo base_url(); ?>" + "research_science/Details/" + returnedData.research_id});

我在 header 中也用过 og:image 属性,但这仅适用于 Facebook,不适用于其他社交网站。

谢谢。

Google, Facebook and twitter like all social website just read source code of website. Social website not run your client-side js script; you need generate this type of tags in server side(via PHP script).