且构网

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

如何让Facebook登录按钮重定向到特定的URL

更新时间:2022-01-04 02:52:58

1)您也可以使用这样的代码重新登录(请注意 auth.login event):

1) You can also redirect on login using some code like this (note the auth.login event):

 <script src="http://connect.facebook.net/en_US/all.js">
  </script>
  <script>
      FB.init({
          appId: '??????????????', cookie: true,
          status: true, xfbml: true
      });
      FB.Event.subscribe('auth.login', function () {
          window.location = "http://example.com";
      });
  </script>
  <fb:login-button>
     Login with Facebook
  </fb:login-button>

2)要确定是否显示或隐藏登录按钮,可以使用 FB.getLoginStatus 来发现用户是否登录。以下页面可能会被使用: http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/

2) To determine whether to show or hide the login button, you can use FB.getLoginStatus to discover whether the user is logged in. The following page might be of use: http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/