Detecting when tab has been closed #353
Unanswered
MarianaKWork
asked this question in
Q&A
Replies: 1 comment 2 replies
-
As far as I know the only way to do this is with the beforeunload event. You would definitely want to use that event to ensure your logout call finishes before the browser shuts down. You can mitigate the performance impacts by using a sendBeacon ping to your server to log your user out. If it's purely client side I wouldn't worry about the performance impact. It should be negligible. This library does track tabs but does not currently expose an event that you can hook into. It's definitely something that I would consider adding, but It's going to be a bit before I have time to do another major feature. Fee free to open a feature request. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I was wondering if there is a way to use the library to detect when a tab has been closed, as I would then like to be able to log the user out.
I do not want to listen for the 'beforeunload' and 'unload' events as this is not recommended due to unreliability and performance issues it can cause.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions