Vva Present
Vva Present

Reputation: 1

Facebook iframe app. it is possible refresh when user log out from other browser tab

I have an iframe application. When a user and another page and log in to facebook site, the application page is reloaded by facebook. But, I want to reload the page in the logout state also.

Here is the scenario:

  1. A user enters my iframe application and authorizes my app and successfully enters my app.
  2. While using my app, the user opens my app (or fb site) in another browser tab.
  3. The user logs out from facebook site in the last browser tab.

When user logs out from facebook, I want to automatically reload my application page in the browser.

How can I do this?

Upvotes: 0

Views: 1383

Answers (2)

Omtara
Omtara

Reputation: 3001

Unfortunately, your options are limited as communication with an IFRAME is very constrained. This may help you:

http://www.dyn-web.com/tutorials/iframes/refs.php

Upvotes: 0

Charley P.
Charley P.

Reputation: 174

Have a look at FB.Event.subscribe, I think you should be able to use it to reload the page when the user's session changes.

Add something like this to your FB.init:

FB.Event.subscribe("auth.sessionChange", handleSessionChange);

...and the handleSessionChange callback function would look something like this:

function handleSessionChange(response) {
  if(!response.session || response.session.uid!="$user_id"){
    window.location.reload();
  }
}

Upvotes: 2

Related Questions