FB.getLoginStatus not working?

The FB.getLoginStatus function for some reason does not work, although it has been used for some time. The code is very simple below and the warning never pops up - it looks like FB.getLoginStatus never calls the provided function. Any ideas?

<body>
<form id="form1" runat="server">
<div id="fb-root">
</div>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
    FB.init({ appId: 'xxx', status: true, cookie: true, xfbml: true });
    FB.getLoginStatus(function (response) {
        alert("Hi there");
    });
</script>
</form>

+5
source share
2 answers

If your application is in Sandbox Mode, see this error: https://developers.facebook.com/bugs/240058389381072

Also read Philippe Bullie's comments

[...] , . Facebook, Facebook , (FB, , , , !).

.

+6

? FBML, FBJS-Facebook JavaScript. , FBML. .

<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
    FB.init({appId: 'APP_ID', status: true, cookie: true, xfbml: false});
};
(function() {
    var e = document.createElement('script');
    e.type = 'text/javascript';
    e.src = document.location.protocol +
        '//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
}());
window.fbAsyncInit = function() {
     FB.init({appId: 'APP_ID', status: true, cookie: true, xfbml: true});

         /* All the events registered */
         FB.Event.subscribe('auth.login', function(response) {
             // do something with response
             login();
         });
         FB.Event.subscribe('auth.logout', function(response) {
             // do something with response
             logout();
         });

         FB.getLoginStatus(function(response) {
             if (response.session) {
                 // logged in and connected user, someone you know
                 login();
             }
         });
     };

0

All Articles