开发者

fb:like a different page to the current one

开发者 https://www.devze.com 2023-03-08 11:33 出处:网络
I am using <fb:like> tags to generate like buttons for my website, I am using this so I can track when a user likes or dislikes a page.

I am using <fb:like> tags to generate like buttons for my website, I am using this so I can track when a user likes or dislikes a page.

For some reason the like buttons only work when they are displayed on the page you are liking.

I have like buttons for other pages but they do not work correctly unless I use the <iframe> model. Why is this?

When you click the like button it connects to facebook successfully, changes the like counter then immediately reverses it to its original state?

I am using the following code <fb:like href="http://URL" send="false" layout="button_count" width="85" show_faces="false" font=""></fb:like>

And I use this to get the FB JS files:

  (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());

  window.fbAsyncInit = function() {
    FB.init({appId: 'XXXXX',
            status: true,
            cookie: true,
            xfbml: true});
  });

Edit:开发者_如何学JAVA They seem to work in Chrome but not FF or IE.


From the Facebook developer documentation (http://developers.facebook.com/docs/reference/plugins/like/):

There are two Like button implementations: XFBML and Iframe. The XFBML version is more versatile, but requires use of the JavaScript SDK.

Are you using the FB Javascript SDK?

0

精彩评论

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