fb login popup block fb login popup block jquery jquery

fb login popup block


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.


It's perfectly fine to call FB.login from the callback of FB.getLoginStatus, as long as you are confident that the login status has already been loaded internally. To do this, use one of these:

  • FB.init({..., status: true, ... }).
  • FB.getLoginStatus(...)
  • FB.login(...)
  • FB.ui(...)

Technically all of these options use FB.ui. The async process has to complete, which could take a few seconds. As long as you have already used one of the methods above to make a cross-domain call with FB, and that async process has completed, getting the login status will not make an async call, and the popup will not be blocked.

You should also make sure not to specify true for the second parameter, as in FB.getLoginStatus(..., true);.


Make sure you set status to true, this will fixed popup blocker issue.

window.fbAsyncInit = function() {  FB.init({    appId      : '{your-app-id}',    cookie     : true,  // enable cookies to allow the server to access                         // the session    xfbml      : true,  // parse social plugins on this page    version    : 'v2.5', // use graph api version 2.5    status     : true // set this status to true, this will fixed popup blocker issue  });