开发者

Run FB.logout() when page opens

开发者 https://www.devze.com 2023-03-23 05:08 出处:网络
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

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

精彩评论

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

关注公众号