Skip to content Skip to sidebar Skip to footer

How To Detect Log Out From Fb Using Js Sdk Without Refreshing The Page

Hi friends, I'm developing a website in which Facebook Javascript API is used to send message to our friends. When the user is logged out of fb,then it shows an error when popping

Solution 1:

According to Facebook,

https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/

To improve the performance of your application, not every call to check the status of the user will result in request to Facebook's servers. Where possible, the response is cached. The first time in the current browser session that FB.getLoginStatus is called, or the JS SDK is init'd with status: true, the response object will be cached by the SDK. Subsequent calls to FB.getLoginStatus will return data from this cached response.

This can cause problems where the user has logged into (or out of) Facebook since the last full session lookup, or if the user has removed your application in their account settings.

To get around this, you call FB.getLoginStatus with the second parameter set to true to force a roundtrip to Facebook - effectively refreshing the cache of the response object.

FB.getLoginStatus(function(response) {
  // this will be called when the roundtrip to Facebook has completed
}, true);

Post a Comment for "How To Detect Log Out From Fb Using Js Sdk Without Refreshing The Page"