I am developing a website where I have to switch between different screens. Once the tab is closed on any screen, that user's session is about to be ended.
My problem is that using onbeforeunload and adding some conditions so that you do not leave the session while browsing the different screens of my website works. However, if I use the Chrome browser buttons back / next / refresh, I can do that as well Log out
How can I make sure that I leave the session only when I close the tab, not when I press Back / Next / Refresh?
That way I can control when to close the session: