I am developing a web application , in that I want to log out the user ,only when he closes all the 'tabs' of my application or user closes the browser .
Does anyone know how to do it ?
I am developing a web application , in that I want to log out the user ,only when he closes all the 'tabs' of my application or user closes the browser .
Does anyone know how to do it ?
Try the answer here: Javascript Communication Between Browser Tabs/Windows. Cookies are the usual way to do this. Combine those with the "onunload" event and you should be able to accomplish what you need.
Would be easier, though to simply set your login cookie as "session" by setting the lifetime to 0. This is shared between tabs in most of the browsers I have used and is cleared when the window closes. Only problem is that Internet Explorer tends not to clear session cookies unless the window is closed, not when all tabs of a website are closed.