0

내 사이트의 페이스 북 로그인 앱을 만들었습니다. 그러나 팝업 차단기가이를 차단합니다. 나는 Google에서 onclick 옵션을 추가한다고 말하면서 검색했습니다. 하지만 여전히 작동하지 않습니다. 나는facebook에서 팝업 차단기가 웹 사이트를 연결하는 것을 방지하려면 어떻게해야합니까?

JS 코드 아래에있는 내 코드를 게시 한 :

$(document).ready(function() { 

window.fbAsyncInitialize = function() { 
    FB.init({ 
     appId  : '', // App ID 
     channelUrl : '..../channel.html', // Channel File 
     status  : true, // check login status 
     cookie  : true, // enable cookies to allow the server to access the session 
     xfbml  : true // parse XFBML 
    }); 
    FB.getLoginStatus(function(response) { 
    if (response.status === 'connected') { 
     // connected 
     apiCall(); 
    } else if (response.status === 'not_authorized') { 
     // not_authorized 
     login(); 
    } else { 
     // not_logged_in 
     login(); 
    } 
    }); 

    }; 

    function login() { 
    FB.login(function(response) { 
     if (response.authResponse) { 
      // connected 
      apiCall(); 
     } else { 
      // cancelled 
     } 
    }, { scope: 'email' }); 
    } 

    function apiCall() { 

    console.log('Welcome! Fetching your information.... '); 
    FB.api('/me', function(response) { 

     var first_name = response.first_name; 
     var last_name = response.last_name; 
     var fb_id = response.id; 
     var email = response.email; 


    }); 
    } 

    // Load the SDK Asynchronously 
    (function(d){ 
    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; 
    if (d.getElementById(id)) {return;} 
    js = d.createElement('script'); js.id = id; js.async = true; 
    js.src = "//connect.facebook.net/en_US/all.js"; 
    ref.parentNode.insertBefore(js, ref); 
    }(document)); 
}); 

HTML :

어떻게 변경하거나 팝업 차단 문제를 방지하기 위해 추가해야합니까?

감사

답변

0

당신은 오히려 인증 대화 상자를 팝업보다 로그인 페이지로 사용자를 리디렉션 할 수 있습니다.

또한 사용자 작업에 의해 로그인이 트리거되도록 할 수 있습니다. 사용자가 팝업을 트리거하는 링크를 클릭하면 (프로그래밍 방식으로 로그인을 트리거하는 것이 아니라) 차단 될 가능성이 훨씬 적습니다.

관련 문제