1
<body>
      <div id="fb-root"></div>
      <script src="http://connect.facebook.net/en_US/all.js"></script>
      <script>
         FB.init({ 
            appId:'OUR_APP_ID', cookie:true, 
            status:true, xfbml:true 
         });
      </script>

      <script>
        FB.Event.subscribe('auth.login', function(response) {
        alert("Logged in.. Redirecting you now...");
        window.location = 'http://localhost:7001/Facebook/success.jsp';
        });
      </script>

      <fb:login-button perms="email,publish_stream,about_me" onlogin="window.location='http://localhost:7001/Facebook/success.jsp'"></fb:login-button> 
</body>

I am able to login to Facebook using the tag. But, after that, I need to redirect the user to another page where I can display his/her data like Name, email, gender, etc. The window.location for redirection isn't working. This problem is not only for localhost. The problem persists even if I put google in place of the localhost URL. Does facebook not allow javascript redirection anymore or has facebook decided to stop supporting onlogin which is not a DOM event on its own but a specific from Facebook? Please help me. Thanks in advance!

4

1 に答える 1

1

あなたの問題 `http://localhost:7001/Facebook/success.jsp'">

現在、絶対 URL タイプを使用していますが、次のような相対タイプの URL を使用する必要があります。 <fb:login-button perms="email,publish_stream,about_me" onlogin="window.location='/Facebook/success.jsp'"></fb:login-button>

于 2014-02-27T06:35:53.807 に答える