You cannot call FB.login
from the callback of FB.getLoginStatus
.
Browsers tend to block popup windows of the popup is not spawned as an immediate result of a user's click action.
Because FB.getLoginStatus
does an ajax
call and you call FB.login
on it's response, the popup that would open as a result of this call is blocked.
A solution to your problem would be to call FB.getLoginStatus
on page load and use the response inside your fb_login()
method.