Facebook(无标题)在Ajax页面上使用addThis时

时间:2013-07-24 15:53:31

标签: javascript jquery ajax addthis

我使用addThis在项目上创建共享按钮,电子邮件和Twitter工作正常但是Linkedin和Facebook不起作用。我知道他们需要opengraph才能工作,但是如果你的内容是javascript驱动的呢?目前Facebook弹出窗口只显示(没有标题)..有没有其他人能够获得Facebook分享在AJAX页面上为addThis工作?

提前谢谢。

这是我目前在我的页面上使用的脚本。

 <!--- 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 --->

我的应用程序使用的URL的一个示例..

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

1 个答案:

答案 0 :(得分:0)

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

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

这对我来说是一个很好的起点,可以解决你描述的同样问题:

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

再见!