@RichardMarsot We are upgrading from Pega 7 On-Perm to Pega cloud and in 7 we have logoff on browser close which Users usually close the browser and logoff script has been configured purposefully to make the session logoff. In Cosmos, Client expecting the same behavior . Could you advise or any design or piece of code how to achieve the behavior. In cosmos, since its a single page architecture and user can open multiple windows as opposed to 7, wondering how to achieve this .
@RichardMarsot Yeah. we tried beforeunload but the problem is when the user has multiple browser windows opened with different cases, Logoff on close one window affecting the other windows which user is working. in 7 its a only a single window it was not a problem.
if the user has 3 windows opened with 3 cases and he/she is done with one case and close the window, If I trigger logoff script, the other 2 windows will be logged off. Ideally I believe we should logoff on last window (3rd) close.
Posted: 6 months ago
Posted: 8 Jul 2021 11:44 EDT
Richard Marsot (RichardMarsot)
Director, Front-end Development
@venugopalakrishna this is correct - you can maintain a list of tabs opened using a localstorage. the entry for each tab is remove when closing one of the tab
I have never seen an application that auto-logs out a user when closing a tab though.
the other approach is to delete passivated sessions more aggressively - by default passivated sessions are removed after 2 days. you can change that to be after 15 mn of inactivity. You can then use the pxSessionTimer to detect inactivity as documented in my post shared above