I have this code after FB init :
FB.Event.subscribe('auth.login', function(response) {
alert("login");
});
FB.Event.subscribe('auth.logout', function(response) {
alert("logout");
});
but I notice that, after logged in, the output is “logout” first, than “login”. Why? I won’t to see “logout”.
Please don’t blindly use the callback as Facebook shows in their examples and ignore the response value. Facebook will call the events even though that action really wasn’t performed. That’s why they give you the “response” variable.
You should look at the value of the properties of the response variable before deciding what to do.