Search code examples
facebookfbconnect

specifying redirect url onlogin in <div class="fb-login-button">


This is how i normally specify a redirect url in fbml f-connect tag

<fb:login-button onlogin='redirect-url'>f-connect</fb:login-button>

How do i specify a redirect url 'on login' in:

<div class="fb-login-button">f-connect</div> ??


Solution

  • You just do it the other way now. Since there is no any redirect_uri for Login Button you need to FB.Event.subscribe for auth.authResponseChange event to know then user is logged-in:

    FB.Event.subscribe('auth.authResponseChange', function(response) {
      if (response.status === 'connected') {
        window.top.location = '//redirect-url.com';
      }
    });