0

Im using addThis for create share button on a project, email and twitter work fine but Linkedin and Facebook do not work. I understand they need opengraph to work but what if your content is javascript driven? At the moment the Facebook popup simply shows (no title).. Has anyone else been able to get facebook share to work for addThis on AJAX pages?

Thank you in advance.

This is the script Im using on my page at the moment.

 <!--- share --->
                <div class="share-buttons" id="toolbox-5"></div>
                <script type="text/javascript">
                var tbx = document.getElementById("toolbox-5"),
                    svcs = {
                        email: 'Email',
                        print: 'Print',
                        // facebook: 'Facebook',
                        twitter: 'twitter',
                        // linkedin: 'linkedin'
                    };

                for (var s in svcs) {
                    tbx.innerHTML += '<a class="addthis_button_'+s+'">'+svcs[s]+'</a>';
                }
                addthis.toolbox("#toolbox-5"
                    , {}
                    , {url: "www.urlofthing.com"
                    , title: "title of thing"});
                // );
                </script>
                <!--- share --->

An example of the URL my application uses..

http:domain.com/dir/section/#!/3/1017/
4

1 回答 1

0

加载新内容后,尝试通过特定的 AddThis 方法强制 url:

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

这对我来说是解决您描述的相同问题的一个很好的起点:

AddThis 按钮不会更新以包含片段(#Hash 标签)

再见!

于 2013-10-01T14:56:21.997 回答