w3c idle detection · know when the user stopped touching their computer · screen locked or unlocked · user active or idle · runs locally
what is this
the w3c idle detection api lets any page know whether you are actively using your computer — across all input devices and applications, not just the browser tab. it also reports whether your screen is locked. the minimum threshold is 60 seconds.
this is how a web app can detect “user stepped away” without polling the document for mousemove/keydown. a note-taking app might auto-save when you go idle. a less ethical use: ad platforms measuring true time-on-page versus browser-tab-open time.
✦ requires permission · threshold: 60 s · walk away from your keyboard to trigger idle state
detector
why this matters
- not just tab focus. unlike
document.hasFocus()orvisibilityState, idle detection knows you're away even if the browser window is active. you could be staring at the screen motionless — and after 60s, the api fires. - screen lock detection is sensitive. knowing the screen is locked tells a page the device is unattended. combined with other signals, this can infer break patterns, meeting times, and work hours.
- explicit permission, but still surprising. most users expect permissions to cover camera/mic. idle detection — covering global input presence — is less intuitively understood as a privacy surface.
- minimum 60s is a privacy tradeoff. the w3c spec enforces a minimum threshold precisely to prevent fine-grained activity tracking. coarser granularity limits the worst surveillance use cases while keeping the api useful for legitimate ux purposes.