2

I am trying to do facebook login on my web site, and I have been using the new Facebook Javascript SDK's FB.Login function.

The login works perfectly in FireFox and in Chrome. The login works in IE as well, however the problem is that the facebook popup window stays open blank (user is logged in and redirected, as needed).

Does anyone know any secret for IE so that the popup window will close?

Here is my code: (it is an asp.net mvc site so this is in a parial view)

 <div id="fbLoginS" class="smallloginbutton facebooksmall">Facebook Login</div>
 <div id="fb-root"></div>
 <!-- facebook login -->
 <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
    <script type="text/javascript">
        <% string facebookaction = Url.Action("FacebookLogOn", "Account");%> 

        FB.init({ appId: '<%:FacebookSettings.Current.AppId %>', status: true, cookie: true, xfbml: true });
        $('#fbLoginS').click(function () {
            FB.login(function (response) {
                if (response.session) {
                    window.location = '<%:facebookaction %>';
                } else {
                    // user cancelled login
                }
            }, { perms: "email" });
        });
    </script>
     <!-- facebook login -->

Thanks a lot for the help, Apolka

apolka
  • 1,711
  • 4
  • 16
  • 23

2 Answers2

3

Maybe it will help someone, so here is the solution:

  • In IE if you configure a port in your site link (i.e. http://localhost:1234) the whole facebook connect does not work at all
  • If you just use http://localhost then the login works however the popup stays open blank as described in the question
  • If you use http://127.0.0.1 or your productiton URL everything works fine :)
apolka
  • 1,711
  • 4
  • 16
  • 23
0

This can also occur if your app is set to Sandbox mode, and a user who isn't flagged as a "developer" or "tester" of the app attemts to log into the app.