0
我已經使用這個代碼,以便在使用Facebook網站註冊連接禁用自動登錄連接
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: "<?=FB_APP_ID?>", status: true, cookie: true, xfbml: true});
/* All the events registered */
FB.Event.subscribe('auth.login', function(response) {
// do something with response
alert('Here');
login();
});
FB.Event.subscribe('auth.logout', function(response) {
// do something with response
logout();
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
function login(){
document.location.href = "<?=SITEPATH?>users/fb_login";
}
function logout(){
document.location.href = "<?=SITEPATH?>users/logout";
}
</script>
<fb:login-button perms="user_hometown,email,user_birthday">Login with Facebook</fb:login-button>
這是工作正常,當用戶第一次登錄到該網站,並沒有臉書會。如果我已經打開了Facebook頁面,並且我點擊了fb按鈕,它就不會進入fb_login頁面。實際上,我想禁用自動登錄。預先感謝