0

First off, apologies if the title isn't descriptive. What I'm trying to do is logout/expire from a session no matter how many tabs are open.

So to explain a bit more in detail, let's say I have all tabs open. After a certain time of inactivity a modal will open and will show up in all tabs (which already works and happens). When I click on the main window, it executes the functions as I'd expect. It fires expire, then it logs out, then it redirects.

The issue is when I'm clicking on the logout from the modal in Tab 2 or 3, it is running the expire, logging out then redirecting.

What should happen is T1 should fire the expire, logout for all tabs and then each tab will do it's own redirect.

I have tried by passing functions to windows by their name but the tabs don't have reference to each window name, only their own. I believe this is something to do with Execution Context but I'm not 100% sure. There is code for adding each Tab that's opened to sessionStorage as an App but it's only storing the basic information, not the context of the App.

I'm coming into someone else's code and trying to wrap my head around what was written and the change that has to be done.

Any help would be greatly appreciated.


For example:

Tab 1: This is the main window and should handle all the execution of scripts and ajax/network calls.

Tab 2: Is an application launched from Tab 1. When the modal shows up and I click a button, execution of ajax requests should not be handled in this tab but Tab 1. After Tab 1 finishes all the calls, then Tab 2 will redirect to a landing page.

Tab 3: Is an application launched from Tab 1. When the modal shows up and I click a button, execution of ajax requests should not be handled in this tab but Tab 1. After Tab 1 finishes all the calls, then Tab 3 will redirect to a landing page.


ethikz
  • 379
  • 4
  • 24
  • https://stackoverflow.com/questions/28230845/communication-between-tabs-or-windows – Alnitak Nov 07 '19 at 12:33
  • What if you're logged in within *different browsers*, instead of tabs within the same browser…? – deceze Nov 07 '19 at 12:34
  • @Alnitak, they are using Broadcast channels and the messages are posting but the issue still exists. Both tabs will execute expire, logout then redirect when only Tab 1 should run the expire, logout. Or am I missing something there? – ethikz Nov 07 '19 at 12:40
  • @deceze, as of currently it's only the same browser. Each browser is a new session. – ethikz Nov 07 '19 at 12:41
  • 1
    What you appear to be missing is _additional logic_ in the application to determine which tabs respond to which messages. – Alnitak Nov 08 '19 at 12:52

0 Answers0