Linked Questions

Popular Questions

FB.getLoginStatus not working

Asked by At

I am trying a simple code to verify whether the user is logged to facebook when visiting my website.

alert 1 and 2 are displayed and thats all.

Why isnt alerts 3 4 5 not shown?? Ive tried so many examples but nothing works :( :(

<!DOCTYPE html>
<html>
<head>
  <script src="http://connect.facebook.net/en_US/all.js"></script>
  <script>
    window.onload = function(){
      alert("1");

      FB.init({ apiKey: '203642573046113', status: true });

      alert("2");

      FB.getLoginStatus(function(response) {
        alert("3");
        if (response.status === 'connected') {
          alert("4");
        } else if (response.status === 'not_authorized') {
          alert("5");
        } else {
          alert("6");
        }
      });
    };
  </script>

</head>
<body>
    HELLO WORLD
</body>
</html>

Related Questions