How to end sessions automatically if user closes the browser

前端 未结 6 1330
孤街浪徒
孤街浪徒 2020-12-10 09:12

I need to end the session automatically when the user is inactive for some particular time say for 10 minutes. We have a method in

HttpSession session=reque         


        
6条回答
  •  南笙
    南笙 (楼主)
    2020-12-10 09:42

    There is no way to intimate the server about the user closes the browser. That's why the sessions are having configurable timespan. If you wanna do it then try by creating a onclose javascript event and from there do an ajax call to intimate the session close to the server. In the server you can get the session id from this call as parameter and kill it.

    I didn't tried it. Don't think it is right to do.

提交回复
热议问题