Hacker News new | ask | show | jobs
by maxloh 975 days ago
It is possible currently. Just attach an `beforeunload` listener which asks the server to invalidate the current session.
1 comments

I just tried it (Chrome on Mac), and beforeunload is not called when I lock the machine. The MDN docs also don't suggest that it should be.
For the "invalidate session on screen lock" feature, it is possible to create close enough workarounds in today's JavaScript.

https://stackoverflow.com/questions/15959244/

Bottom line, you can simply listen to mouse move events and invalidate the current session on user inactivity.