开发者

Facebook share/comments don't work like they should

开发者 https://www.devze.com 2023-01-23 10:30 出处:网络
In my page I\'ve added Facebook Comments as well as Share button. Everything was done according to their instruction, so :

In my page I've added Facebook Comments as well as Share button. Everything was done according to their instruction, so :

I've included loading script :

<div id="fb-root"></div>
<script type="text/javascript">
    window.fb开发者_如何学GoAsyncInit = function() {
    FB.init({appId: '161771113844567', status: true, cookie: true, xfbml: true});
    };
    (function() {
    var e = document.createElement('script');
    e.type = 'text/javascript';
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
    }());
</script>

and then on pages that use comments/share:

    <div class="facebook-comments">
        <fb:comments xid="{{star.uniq.id}}" url="" title="Test"></fb:comments>
    </div>

and:

    <a name="fb_share" type="box_count" share_url="url" 
    href="http://www.facebook.com/sharer.php">
        Share
    </a>
    <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

but the comments are loaded only from time to time (otherwise a FB.provide is not a function error is shown) and share button shows 0 all the time. Is there a way to fix this ? I've tried downloading all.js but then comments where not loaded at all.


You are using both the old javascript SDK and the new one. The facebook sharer.php is no longer recommended an is being replaced by the like button. The solution is to remove the Facebook Share and replace it with a like button. This way you will only be using the new Javascript SDK http://connect.facebook.net/en_US/all.js. You cannot use both of these at the same time. static.ak.fbcdn.net/connect.php/js/ is the old SDK and is being deprecated.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号