且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查用户是否是我网站上Facebook页面的粉丝?

更新时间:2023-12-01 18:43:16

我认为您几乎是正确的. 此代码段对我非常有用.

I think you almost had that correct. This snippet works great for me.

假设: 1. fanPageUID =风扇页面的uid 2.用户UID是用户的UID 3.(并且您有一个活跃的会话)...这可能是困难的部分,但不是此问题的一部分.

assumes: 1. fanPageUID = the fan page's uid 2. and user UID is the UID of the user 3. (and you have an active session)... this may be the hard part, but not part of this question.

  function checkifFan() {
    FB_RequireFeatures(["Api"], function(){
    var api = FB.Facebook.apiClient.pages_isFan(fanPageUID,userUID,function(response){
        if (response==false) {
          setTimeout('checkifFan()', 300); //every 300ms check if they have pressed fan
        }
        else {
          location.reload();
        }
    });

    });
  }