내 웹 페이지에 Facebook 로그인/등록 플러그인을 포함하려고합니다. 로그인을 클릭하거나 로그 아웃을 클릭하면 해당 FB.Event.subscribe이 트리거되어야합니다. 하지만 제 경우에는 로그인과 로그 아웃이 성공적으로 이루어집니다. 그러나 그 사건들 중 아무 것도 유발되지 않습니다. 사람이 여기에 나를 도와 수 있다면 FB.Event.subscribe - 이벤트가 트리거되지 않습니다.
<div id="fb-root"></div>
window.fbAsyncInit = function(){
FB.init({
appId : 'xxxxxxxxxxxxxxxxxxxx',
status : true,
cookie : true,
oauth : true,
xfbml : true
});
FB.Event.subscribe('auth.login', function(response) {
FB.api('/me', function(response) {
alert('You have successfully logged in, '+response.name+"!");
});
});
FB.Event.subscribe('auth.logout', function(response) {
FB.api('/me', function(response) {
alert('You have successfully logged out, '+response.name+"!");
});
});
FB.getLoginStatus(function(response) {
if (response.session) {
alert('Hello');
}
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
그것은 좋은 것, 코드를 보자. 미리 감사드립니다.