Take the 2-minute tour ×

I am using Spring-ROO as well as Spring security for my web application. I have set the session-timeout as 10. On closing the browser, the session is not getting closed automatically. Can anyone tell any method to close the session when the browser is closed?

Is there any configuration available to have this settings?

Please note that I cant use jquery/javascript.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

I don't think this is possible, as no OnBrowserClosed event exists. The only thing that gets close is the non-standard window.onunload DOM event, which you could catch, but that would mean having custom logic run whenever you navigate from one page to another, and even then I don't think you can access the URL the user is going to next, which would be required to know that the user is actually going away from your site (something like null meaning that he goes to no site at all).

One think you could do is to set the timeout even shorter and have a JavaScript on every page that pings the server in regular short intervals using AJAX, but that's a dirty hack, and it would lock out anyone who has JS turned off. A clean solution is not possible IMHO.

share|improve this answer
Is that possible in Spring ROO. I guess we should not use javascript in Spring ROO (Please tell if that is possible). Is there any Spring security configuration available (version 3)? –  user1514499 Jul 9 '12 at 11:14

Your Answer


