Hacker News new | ask | show | jobs
by paulgb 964 days ago
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.
1 comments

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.