Determine if all application tabs are closed

I am developing a web application in which I want to log out only when it closes all the "tabs" of my application or the user closes the browser.

Does anyone know how to do this?

+7
source share
1 answer

Try answering here: Javascript Link between browser / Windows tabs . Cookies are a common way to do this. Combine them with the onunload event and you can accomplish what you need.

It would be simpler if you just set your cookie to log in as a β€œsession” by setting the lifetime to 0. This is shared between the tabs in most browsers that I used, and cleared when the window closes. The only problem is that Internet Explorer does not try to clear session cookies unless the window is closed, and not when all the tabs of the website are closed.

0
source

All Articles