JillElaine / jquery-idleTimeout

Idle activity timeout and logout redirect for jQuery for multiple windows & tabs
Other
72 stars 79 forks source link

Logged out of iframes, not main page #49

Open elector-zz opened 6 years ago

elector-zz commented 6 years ago

I have a javascript SPA application where I am loading pages as iframes into javascript made tabs. Using Ext.JS components. When logout happens, it logs out from the tab iframes but not the main page. Any solution for this please?

JillElaine commented 6 years ago

Are the main page and the i-frame pages from the same domain & sub-domain? Are you loading the idleTimeout script only once for your site? Please load the idleTimeout-for-testing script and watch the Javascript console for errors. Perhaps you will be able to see where the script is not passing the logout function from the i-frame to the main page.

elector-zz commented 6 years ago

It's all coming from the same domain and the script is loaded once. I'll give it try with the testing script. Thank you for a super fast reply!

elector-zz commented 6 years ago

I have found that the following change works in my scenario:

logoutUser = function () {
  store.set('idleTimerLoggedOut', true);

  if (currentConfig.sessionKeepAliveTimer) {
    stopKeepSessionAlive();
  }

  if (currentConfig.customCallback) {
    currentConfig.customCallback();
  }

  if (currentConfig.redirectUrl) {
  from: window.location.href = currentConfig.redirectUrl;
  to: window.top.location.href = currentConfig.redirectUrl;
  }
};
JillElaine commented 6 years ago

Thank you for your research and proposed solution. I am not able to make changes to the code at this time, but will leave your issue open so that others with this problem can see it.