I need to detect if the browser is being closed using jQuery, and do an event if this is true. I have a chat feature on my website (much like Facebook) that keeps the user logged in as they navigate to other pages within the website structure but needs to log them out of chat (so they do not appear online to others) if they click the browsers close button. So .unload() will not work because .unload() will apply the logout function to all window actions including navigating to another page within the website structure. .unload() works for browser closes, but also works for browser forward and backward navigation, so I need a way to detect if the browser is being closed AND ONLY if the browser if being closed.
I need to detect if the browser is being closed using jQuery, and do
Share
Whatever you’re using for chat (orbited, websockets?) should be able to detect a session timeout.