Reputation: 73
A simple question that I just can't find an answer for. I want to stop a periodic AJAX call when the user has wandered away and locked their PC. I don't need it to be every OS compatible or every browser (Chrome and IE would be good).
setInterval just doesn't seem to stop when locked and AJAX is also not prevented. The visibilitychange event seems to think that the tab is visible unless you switch to another tab.
I have stated javascript, but I only care that it can be done within the browser without asking the user.
Edge does seem to indicate it is hidden when locked, so I'm ok with that browser.
Thanks
Upvotes: 3
Views: 5632
Reputation: 13570
In your javascript it is not possible to detect if the OS UI has locked. The browser sand box prevents this kind of access to OS resources for security reasons. You would need to write a browser plugin to do this.
Upvotes: 2