django-session-security
django-session-security copied to clipboard
Option to end session on tab close
trafficstars
One of the requirements for a project that I am working on is that the session would expire on tab close. I can imagine other may want a similar feature. I propose that this app implement an endpoint that the client can call .onbeforeunload() and the server will invalidate the session.
Django has built-in support for this.
That will not work if I just close my tab without closing the window.
I have been looking up how I might do this, and actually there's no easy way to differentiate navigation to a new page vs closing the tab. 🤔 So .onbeforeunload() is actually not viable