The ONLY way to notify the server that the browser is no longer there or is moved to another site is to put some Javascript in the onunload event for the body tag of the page.
Here you can have the browser then call a
servlet on the server which can invalidate the session.
As said, there is a potential problem in that it also gets called when you move to another page on your site, but I think there are ways to circumvent that.
I've never used the function myself.