Hi sammeta, I wanted to respond to your P.M. about this topic.
The only thing that I really can say is to agree with Jeanne. If you are following a link to an application you control then you can provide an IFrame that goes back to the first app and logs the user out. A similar alternative would be to make any links to the second application a link to a logout page in application 1 that then redirects to a page in application 2. This way you can keep the session control in a single app (you could pass the URL to application2's page as a parameter to the logout page).
As Jeanne said, you still can't tell if the user goes to some other website, or closes their browser. In addition to those limitations, the one I proposed also wouldn't work if the user makes bookmarks for the application2 page, or manually enters the application2 page's URL into the address bar.
<p.s. sammeta, I am happy to help, and don't mind the P.M.s asking me to take a look at a particular
thread. But as an FYI I will always respond in the thread itself, since it will help the JavaRanch community as a whole>