Run FB.logout() when page opens
Is there a way to run FB.logout() when the page first loads? Or is it开发者_C百科 only possible when the user clicks it and triggers it? Thanks!
You don't need jQuery, simply add the call to FB.logout in your window.fbAsyncInit function:
window.fbAsyncInit = function() {
FB.init({
appId : 'appid',
channelURL : '//site/channel.html'
status : true,
cookie : true,
oauth : true,
xfbml : true
});
FB.logout();
}
If you're using JQuery just fire the FB.logout() call once the page is in a 'ready' state. Docs can be found here. You could also just use the built in javascript method window.onload
.
精彩评论