Prevent pop-ups from being blocked

前端 未结 5 1091

I am using a Facebook login method in my code on page load, but when I execute this code, the pop-up blocker closes the Facebook permission window.

How can I open th

5条回答
  •  独厮守ぢ
    2020-12-05 06:10

    You can do something like -

    var uri = encodeURI('http://example.com');
    FB.getLoginStatus(function(response) {
          if (response.status === 'connected') {
                    window.location.href=uri;
          } else {
             window.location = encodeURI("https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri="+uri+"&response_type=token");
          }
    

    This will just redirect directly instead of opening a pop-up

提交回复
热议问题