The FB.login dialog box does not close on Google Chrome

advertisements

I'm calling FB.login() on a click event in my application. The dialog pops up as expected, but when the user is done logging into Facebook (and/or authorizing the app), the dialog does not close. Instead it loads a white page (inside the dialog) and the title changes to XD Proxy.

This only happens on Google Chrome (I'm using the latest version available right now for Windows 7).

This doesn't happen if Chrome is in Incognito mode.

The fb-login 'social plugin' works fine on Chrome.

To test/debug this further, I created a new Facebook App with vanilla settings. The only change I made was set the Site URL in the app settings. Here's HTML code that you can use to recreate this bug.

Sample Code for recreating issue

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Chrome Bug Test</title>
    </head>
    <body>
        <button onclick="dologin()">Login using Facebook</button>

        <div id="fb-root"></div>
        <script src="http://connect.facebook.net/en_US/all.js"></script>
        <script>
          FB.init({
            appId  : '[YOUR APP ID HERE]',
            status : true, // check login status
            cookie : true, // enable cookies to allow the server to access the session
            xfbml  : true  // parse XFBML
          });
        </script>

        <script type="text/javascript">
            function dologin(){
                FB.login(function(r){
                    if(console && console.log) {
                        console.log(r);
                    }
                });
            }
        </script>

    </body>
</html>

Facebook Settings that I've tried changing

  1. Setting a site domain, didn't change anything.
  2. Using a custom channelUrl and channel file, didn't help either.

Related bugs tracked at Facebook

Related issues here on Stack Overflow

  • Blank popup with FB connect
  • facebook connect blank pop up on chrome
  • Facebook Connect Login redirecting in Chrome and Safari
  • https://stackoverflow.com/questions/4423718/blank-page-with-fb-connect-js-sdk-on-after-permission-request
  • Facebook connect showing blank popup on login in Internet explorer 8
  • Facebook login popup window stays open when using Fb.login in IE
  • JS SDK FB.login() works but pop-up dialog is staying open after logged in
  • Facebook login hangs at "XD Proxy" when page is installed via Chrome Web Store
  • XD Proxy Facebook
  • XD_Proxy popup won't close

I've seen many people come across this, but what bugs me is that I haven't been able to find a concrete fix for this. Facebook hasn't responded to bug reports yet. One solution would be get rid of Javascript based authentication code and do it solely using serverside mechanism (Facebook PHP SDK). I'd like to avoid that due to time constraints.

Anyone have any ideas how to fix this?


I got a similar call to FB.login() to close the dialog box by changing

onclick="dologin()"

to

onclick="dologin(); return false;"