Get Facebook login status in real time

This question is related to my other question: How to find out if a user logs out of Facebook, FB.Event.Subscribe does not work

In this question, I tried to get a callback event when users log out of Facebook. But since he does not have a suitable answer, I have to try another way. I am trying to poll to get user login status in javascript, for example:

        function checkLogin()
        {
            alert("in");
            FB.getLoginStatus(function(response) {
              if (response.status == "connected") {
                // logged in and connected user, someone you know
                alert("ok - 5 seconds has passed");
              } else {
                // no user session available, someone you dont know
                alert("not ok");
              }
            });
            t=checkLogin("timedCount()",5000);
        }

The problem is that: the function returns the correct result on the first call . After that, it seems that the result is cached, and I constantly received a “connection” in response, although the user silently left another page in the browser.

, Facebook , . , ( !).

FB dev , :

FB.getLoginStatus, HTTP- www.facebook.com, . , FB.getLoginStatus , cookie, HTTP- facebook.com

, , . , Facebook .

- , ?

,

+1
1

, , .

, FB.init(), cookie:false getLoginStatus. cookie .

FB.init({ 
        appId:'${appId}', 
            cookie: false, 
        status: true, 
        xfbml: true 
    });

FB.getLoginStatus(function (response) {
        if (response.session) {
                alert("here");
        }
});
+1

All Articles