나는이 행동을보고 있었으므로 그 원인을 발견하면 알려 주시기 바랍니다. 한편
, 내가 해결 해낸 : 사용자가 페이스 북에 로그인하면
이 코드는 먼저 (즉, 버튼이 가끔 표시되지 않는 경우에만 것 같다)를 참조 할 수 있습니다. 그런 다음 Facebook 로그인 버튼이 성공적으로 나타나는지 확인합니다. 나타나면 "백업 버튼"을 숨 깁니다.
* 나는 ".fb_button"의 클래스 (버튼의 존재를 모든 요소를 확인하는 jQuery 코드 ($ (...)를 사용하고 있습니다 :
사용 JS 로그인 상태를 확인합니다) 및 백업 버튼을 숨길 수는 jQuery를 사용하지 않는 경우, 당신은 몇 가지 표준 자바 스크립트를 사용해야합니다
function fbLoginBandaid() {
FB.getLoginStatus(function(response) {
console.log(response);
if ((response.status)&&(response.status=='connected')) {
//They are logged into Facebook and are connected to our site.
//if the Facebook button did not render, we'll show the backup
if ($('.fb_button').length > 0) {
$('.fbloginbackup').hide();
}
}
} else if ((response.status)&&(response.status=='notConnected')){
//They are logged into facebook but not connected to this site
//if the Facebook button did not render, we'll show the backup
if ($('.fb_button').length > 0) {
$('.fbloginbackup').hide();
}
}
});
}
FB 초기화 코드를 :..
이제
window.fbAsyncInit = function() {
/*...ALL YOUR NORMAL CODE HERE */
fbLoginBandaid(); //bandaid fixes facebook button not showing sometimes. This forces display of a backup button we've made. Sometimes, this cuases two working buttons to show: ours and the Facebok one that should always be appearing.
};
는에 "백업"버튼을 넣어 귀하의 HTML :
<!--Backup Button -->
<a class="fbloginbackup" title="Login with Facebook" href="#" onclick="INSERT_YOUR_LOGIN_SCRIPT(); return false;"><img src="insert_your_button_here.png" width="154" height="22" /></a>
<!-- Button that was supposed to work all the time -->
<fb:login-button length="long" autologoutlink="false" onlogin="fbLogin()"></fb:login-button>
아마도 Facebook 로그인 창을 표시하지 않으므로 이미 Facebook에 로그인 한 사용자의 로그인 스크립트를 사용할 수 있습니다.
희망이 도움이됩니다.
자바 스크립트 콘솔에 erors가 있는지 확인하십시오. 또한 AppId가 있는지 확인하십시오. – Neelam
오류가없고 AppId가 있습니다. 내가 페이스 북에서 로그 아웃 할 때 작동한다. 그러나 내 페이지에서 동일한 html은 물론 그 렌더링에 관계없이 렌더링됩니다. –
Facebook 로그인 버튼을 사용하는 대신 다른 방법으로 갈 수도 있습니다. 페이스 북 이미지가있는 정상 asp buton을 가질 수 있으며 페이스 북 코드가이 버튼의 클라이언트 클릭 이벤트에서 실행됩니다.이 방법으로 aspx 당신이 원하는 방식으로 버튼을 누르십시오. 내 웹 사이트에서 어떻게 그랬습니까. 대답에 대해 – Neelam