I am trying to capture when the user closes the browser window. They are supposed to hit a logout button instead so I can update record changes, set session variables, etc. I have tried onbeforeunload, but this fires every time the page changes. I only need it to happen when the browser itself closes.
Is there a way to do this?