How to close the http session on closing the web browser


i am using struts 1.3.10 , i want to close the http session on closing the web browser.
Bharath Reddy GandluruAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

leakim971Connect With a Mentor PluritechnicianCommented:
set it to expire every 5s for example and in your page, use ajax to increase the expire time
once your page is closed, your ajax stop increase the time

else you can use onbeforeunload but it don't work all time, this is a very bad solution

Here it says to use this method to set your interval for sessions:


Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.