2013-10-04 30 views
2

我正在創建一個fb應用程序,我只是想導航到下一頁,如果用戶已經喜歡我的網頁,並且不喜歡用戶只需點擊它就會去到下一頁。此代碼適用於我的帳戶,但不適用於其他人。你能幫我解決嗎?facebook like按鈕只顯示我的帳戶不爲其他用戶

<div id="fb-root"></div> 
<script> 
    window.fbAsyncInit = function() { 
    FB.init({ 
     appId  : '657165490961669', 
     channelUrl : 'https://www.facebook.com/cypiyow', 
     status  : true, 
     cookie  : true, 
     xfbml  : true 
    }); 

    FB.getLoginStatus(function(response) { 
     var page_id = "228530813943529"; 
     if (response && response.authResponse) { 
     var user_id = response.authResponse.userID; 
     var fql_query = "SELECT uid FROM page_fan WHERE page_id = "+page_id+"and uid="+user_id; 
     FB.Data.query(fql_query).wait(function(rows) { 
      if (rows.length == 1 && rows[0].uid == user_id) { 
     window.location = "email_form.php"; 
      } else { 
    FB.Event.subscribe('edge.create', 
     function(response) { 
      window.location = "email_form.php"; 
     } 
    ); 

      } 
     }); 
     } else { 
      //error message 
     } 
    }); 
    }; 

    (function(d){ 
    var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} 
    js = d.createElement('script'); js.id = id; js.async = true; 
    js.src = "//connect.facebook.net/en_US/all.js"; 
    d.getElementsByTagName('head')[0].appendChild(js); 
    }(document)); 
</script> 
+0

由於page_id不存在(或者只有您有權查看它),所以對我無效。你能更精確一點:鱈魚的哪部分工作不正常,瀏覽器控制檯中是否有任何錯誤消息,...... – DrColossos

回答

1

在Facebook開發區域的應用程序的設置,這是應用在沙盒模式?那會導致它只對你有用,如果這是你的意思,當你說它只是爲你工作。您需要在應用設置中添加一些測試人員或移出沙盒模式