开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜