can not logout from facebook in my application
i am using facebook javascriptSDK in my application. i have used for login and logout from facebook. It is logging me successfully but can not logout from facebook. i am using this function: baseUrl(); ?>/login/logout" class="menu_link" onclick="fb_logout();">Log Out
<script>
FB.init({appId: '061665c433986c406bbeda1b465350c1', status: true,
cookie: true, xfbml: true});
开发者_Go百科function fb_login()
{
FB.login(function(response)
{
if(response.session!=null)
{
window.location.href="http://www.allindiaarchitects.com/registration/index";
}
},{perms:'email,user_birthday,offline_access,publish_stream,read_friendlists'});
}
function fb_logout()
{
FB.logout(function(response)
{
if(response.session!=null)
{
//window.location.href="<?php echo $this->baseUrl(); ?>/login/logout";
}
});
}
</script>
what to do. can any body help me plz.
If you're redirecting the user to a separate page subsequent to the logout of FB you should put that redirect only within the callback function that can be passed to FB.logout as a parameter, like this:
<a href="#" onclick="mysignout(url);">logout</a>
Then redirect only from within the callback function of FB.logout
function mysignout(url)
{
FB.logout(function()
{
top.location.href = 'url'
});
}
FB.logout appears to make an ajax call to revoke authentication on the server and can take several seconds to complete successfully. If you redirect within the anchor link then FB.logout will not have completed successfully before the redirect in some browsers. In particular, this will happen with IE.
See this post: FB.logout not working in IE8
The problem is that the FB.logout method only log the users out of the app ando not from facebook too...
精彩评论