5

Can any one help me in invalidating the session when the user is closing the browser. Whenever the user closes the browser the session should be automatically invalidated in the JSF.

Thanks.

Shahzeb
  • 4,745
  • 4
  • 27
  • 40
user1166528
  • 381
  • 3
  • 7
  • 18

2 Answers2

2

Links below might help.

  1. Browser window close event this uses jquery.
  2. How to invalidate session in JSF 2.0?
  3. .unload() from Jquery Api

Hint: I dont know this will work but making an ajax call in event captured for browser close and invalidating the session in JSF might do the trick for you.

Community
  • 1
  • 1
baba.kabira
  • 3,111
  • 2
  • 26
  • 37
1

When you restart a browser, the FacesContext request sessionId (JSESSIONID cookie) automatically gets a new value. So when you restart a browser check with the older value to make sure same sessionId is running. This is one workaround.

Kesavacharan
  • 318
  • 3
  • 14