-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timeout trigger when user working in multiple tabs of browser. #67
Comments
Did you find how to solve this problem? |
I'm using the document visibilitychange event. When leaving the tab, i stop the watcher, when entering i'm starting it again. I've also utilized the local storage, which is shared between all tabs and the window storage event which is fire when the storage changes. So im able to communicate the timeout to all tabs and open an info dialog. |
@denny99 Good idea. What about if we want to logout user if he is on another website? He is not active on our website, so I would like to log him out, just in case he decide to leave, some sensitive data will be available. |
@denny99 can you please share your solution code ? |
I cannot post you the full code but in the core its something like that: window.addEventListener('storage', (e) => {
if (e.newValue) {
// call all events
}
});
public on(event: string, fn: MultiTabEventFunction): void {
this.events[event].push(fn);
}
public fire(event: string, payload: any): void {
// set own id into data object, we don't wanna listen to our own change
localStorage.setItem(event, JSON.stringify({
tabId: MultiTabSynchronizerService.TAB_ID,
payload,
event
}));
} And when one timeout occurs i |
There is an issue if application is opened in multiple tabs.
If User open application in two tabs of chrome, User working in tab 1 and tab 2 is idle for required time. Application triggers timeout even User is working on tab 1 of chrome.
In our scenario, we are forcefully logout the user. In this case user gets logout from application because other tab is idle.
How to handle the scenario in package.
The text was updated successfully, but these errors were encountered: