简体   繁体   English

facebook,登录后如何重定向用户?

[英]facebook, how to redirect the user after login?

i am trying to redirect the user to a different page after a successful login.我试图在成功登录后将用户重定向到不同的页面。

i have this code:我有这个代码:

<div id="fb-root"></div>
  <script src="http://connect.facebook.net/en_US/all.js"></script>
  <script>
     FB.init({ 
        appId:'11898121834', cookie:true, 
        status:true, xfbml:true 
     });
           FB.Event.subscribe('auth.login', function () {
      window.location = "facebook_login.php";
      //alert ("hello");
  });
  </script>
  <fb:login-button perms="email,user_checkins" >Login with Facebook</fb:login-button>

this wont work.这行不通。 the page refreshes but to the same page.页面刷新但到同一页面。

any ideas?有任何想法吗? Thanks谢谢

insert the new page you want to redirect to in the href attribute在 href 属性中插入要重定向到的新页面

FB.Event.subscribe('auth.login', function () {
      window.location.href = "http://example.com/newpage";

  });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM