Javascript 检查用户是否已在facebook注册

Javascript 检查用户是否已在facebook注册,javascript,facebook,html,facebook-javascript-sdk,Javascript,Facebook,Html,Facebook Javascript Sdk,我创建了一个简单的facebook注册页面。有没有办法检查用户是否使用javascript注册 这是我的注册页面: <div id="fb-root"></div> <script> window.fbAsyncInit = function() { // init the FB JS SDK FB.init({ appId : 'xxxxxxx', // App ID from the App Dashboard

我创建了一个简单的facebook注册页面。有没有办法检查用户是否使用javascript注册

这是我的注册页面:

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    // init the FB JS SDK
    FB.init({
      appId      : 'xxxxxxx', // App ID from the App Dashboard
      channelUrl : 'http://xxxxxxxxxx', // Channel File for x-domain communication
      status     : true, // check the login status upon init?
      cookie     : true, // set sessions cookies to allow your server to access the session?
      xfbml      : true  // parse XFBML tags on this page?
    });

    // Additional initialization code such as adding Event Listeners goes here

  };

  // Load the SDK's source Asynchronously
  // Note that the debug version is being actively developed and might 
  // contain some type checks that are overly strict. 
  // Please report such bugs using the bugs tool.
  (function(d, debug){
     var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement('script'); js.id = id; js.async = true;
     js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";
     ref.parentNode.insertBefore(js, ref);
   }(document, /*debug*/ false));


<div id="fb-root"></div>
<script src="https://connect.facebook.net/en_US/all.js#appId={xxxxxxxx}&xfbml=1"></script>

<fb:registration 
  fields="name,birthday,gender,location,email" 
  redirect-uri="http://xxxxxxxxxxxx"
  width="530">
</fb:registration>

window.fbAsyninit=函数(){
//初始化FBJSSDK
FB.init({
appId:'xxxxxxx',//应用程序仪表板中的应用程序ID
频道URL:'http://xxxxxxxxxx“,//用于x域通信的通道文件
status:true,//在初始化时检查登录状态?
cookie:true,//设置会话cookie以允许服务器访问会话?
xfbml:true//是否解析此页面上的xfbml标记?
});
//附加的初始化代码(如添加事件侦听器)如下所示
};
//异步加载SDK的源代码
//请注意,调试版本正在积极开发中,可能
//包含一些过于严格的类型检查。
//请使用bug工具报告此类bug。
(功能(d,调试){
var js,id='facebook jssdk',ref=d.getElementsByTagName('script')[0];
if(d.getElementById(id)){return;}
js=d.createElement('script');js.id=id;js.async=true;
js.src=“//connect.facebook.net/en_US/all”+(debug?/debug):“)+”.js”;
ref.parentNode.insertBefore(js,ref);
}(文档,/*debug*/false));

谢谢。

是的,当您加载javascript SDK时,添加这一行

});

    // Additional initialization code such as adding Event Listeners goes here
    FB.getLoginStatus(userStatus);
  };
现在在文件底部添加以下内容:

<script>
        function userStatus(response) {
            if (response.status === 'connected') {
              //the user is logged in on facebook and has already authorized your app
            } else if (response.status === 'not_authorized') {
              //the user is logged in on facebook but hasn't authorized your app
            } else {
              //the user is not logged in on facebook so we don't know if he has granted permission to your app
            }
        }
</script>

功能用户状态(响应){
如果(response.status===“已连接”){
//该用户已登录facebook并已授权您的应用程序
}else if(response.status===“未授权”){
//该用户已登录facebook,但尚未授权您的应用程序
}否则{
//该用户未登录facebook,因此我们不知道他是否已授予您的应用程序权限
}
}

非常感谢法比奥。