How to redirect to html page after login with facebook

good afternoon,

I have been trying to use “login with facebook” on my website for 15 days. I have been using the code published by Facebook
My problem with this code is that I want the customer after login with his facebook (through the window that pop out) to be redirected to a specific page on my website, but what happens is that after the customer does login with your facebook, the client is redirected to the same page that asks him to login.

I have already followed the steps that are explained in the link that I mentioned earlier. Could someone help me? Thanks

The code i am using is this:
type or paste code here

</script> <html> <head> <title>Facebook Login JavaScript Example</title> <meta charset="UTF-8"> </head> <body> <script>
  function statusChangeCallback(response) {  // Called with the results from FB.getLoginStatus().
    console.log(response);                   // The current login status of the person.
    if (response.status === 'connected') {   // Logged into your webpage and Facebook.
    } else {                                 // Not logged into your webpage or we are unable to tell.
      document.getElementById('status').innerHTML = 'Please log ' +
        'into this webpage.';
  function checkLoginState() {               // Called when a person is finished with the Login Button.
    FB.getLoginStatus(function(response) {   // See the onlogin handler
  window.fbAsyncInit = function() {
      appId      : '{}',
      cookie     : true,                     // Enable cookies to allow the server to access the session.
      xfbml      : true,                     // Parse social plugins on this webpage.
      version    : '{api-version}'           // Use this Graph API version for this call.
    FB.getLoginStatus(function(response) {   // Called after the JS SDK has been initialized.
      statusChangeCallback(response);        // Returns the login status.
  (function(d, s, id) {                      // Load the SDK asynchronously
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); = id;
    js.src = "";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));
  function testAPI() {                      // Testing Graph API after login.  See statusChangeCallback() for when this call is made.
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
      console.log('Successful login for: ' +;
      document.getElementById('status').innerHTML =
        'Thanks for logging in, ' + + '!';
</script> <fb:login-button scope="public_profile,email" onlogin="checkLoginState();"> </fb:login-button> <div id="status"> </div> </body> </html> <div id="fb-root"></div> <script async defer crossorigin="anonymous" src=""></script> <div class="fb-login-button" data-width="" data-size="" data-button-type="continue_with" data-layout="rounded" data-auto-logout-link="true" data-use-continue-as="true"></div> <script>
1 Contributor
forum0 Replies

* List item

The back of my head’s telling me there should be a redirectURI specified in your parameters, but I can’t find a direct reference to where it’s called.

Alternatively, i think you could use the ‘Successful login’ section to save the user info somewhere like sessionStorage and then document.location.href forward them to the page you want.

Hi m_huntley,
Thank you for your reply.
To be honest with you i am not a coder or even have enough knowledge for do it. But i copied all this code from the facebook tutorial, after i put my app on Facebook working. So, if you or if you have enough knowledge to do help me to get what i want i will be happy to try it. Just tell me how i just put the code i i will try it.
Thank you

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.