Detecting a user closing a browser

Is there a way to detect if a user closes a browser? I would like to free up resources right away in this case, rather than waiting for my session timeout to happen. (CGI application)


I would think that the session object would be the place to look.

The other thing I do is create an array of pages. Every time a new instance of a page is opened, I add it to an array of pages. That way, I can keep all updates across all pages in sync (which is something I want to do for my app). When the page closes, I remove it from the array.

So there’s a number of different ways to detect when a page closes or a session closes. I personally prefer to work with pages as sessions are somewhat more ethereal and confusing to me.