No Login Data Private Local Save

Idle Detection API Demo - Online User Activity Monitor

11
0
0
0

Idle Detection Monitor

Real-time user activity monitoring using Idle Detection API with smart fallback

Native API Available

Waiting to Start

Click "Start Monitoring" to begin

User State
Unknown
Screen State
Unknown
Monitoring Duration
00:00:00
Total session time
Total Idle Time
00:00:00
Cumulative idle
Idle Episodes
0
Times went idle
Last Activity
--
Most recent interaction
Native API minimum: 1 minute (60,000ms)
Event Log
0 events
No events yet. Start monitoring to see activity.
Frequently Asked Questions

The Idle Detection API is a modern browser API that allows web applications to detect when a user is idle (not interacting with their device) and whether their screen is locked. It provides native, battery-efficient idle detection without relying on polling mouse/keyboard events. The API is part of the Web Platform Incubator Community Group (WICG) proposals and is designed with privacy in mind, requiring explicit user permission.

As of 2024, the Idle Detection API is supported in Chromium-based browsers including Google Chrome (version 94+), Microsoft Edge, Opera, and Brave. It requires a secure context (HTTPS) or localhost. Firefox and Safari have not yet implemented this API. On unsupported browsers, this tool automatically falls back to monitoring mouse movements, keyboard events, scrolling, and touch interactions to estimate idle state.

When the native Idle Detection API is unavailable, this tool monitors browser events including mousemove, mousedown, keydown, scroll, and touchstart. A timer continuously checks if the configured threshold has elapsed since the last detected user interaction. If so, the user is marked as idle. Note that screen lock detection is not available in fallback mode, and background tabs may report inaccurately due to browser throttling of timers.

The Idle Detection API requires the "idle-detection" permission. Users must explicitly grant this permission through a browser prompt triggered by IdleDetector.requestPermission(). The permission can be managed under Site Settings → Permissions → Idle Detection. The request must be initiated from a user gesture (e.g., button click). If denied, the API cannot be used until the user manually changes the setting.

The Idle Detection API specification mandates a minimum threshold of 60,000 milliseconds (1 minute). Attempting to set a lower value will throw a TypeError. This limit is intentionally set to protect user privacy and prevent websites from overly granular monitoring of user behavior. In fallback mode, this tool respects the same minimum threshold for consistency.

The IdleDetector provides two distinct state properties: userState indicates whether the user is actively interacting ("active") or has been idle beyond the threshold ("idle"). screenState indicates whether the device screen is "unlocked" or "locked". These are independent — a user can be idle with the screen unlocked, but a locked screen always implies the user is idle.

Idle detection enables several practical features: auto-saving user work when they step away, pausing media playback or animations to save resources, triggering away status in chat applications, logging out inactive sessions for security, analytics on user engagement patterns, power-saving by reducing network requests during idle periods, and showing notifications or nudges when the user returns.

Yes, the Idle Detection API was designed with privacy safeguards. It requires explicit user permission, enforces a 60-second minimum threshold to prevent granular tracking, only reports coarse states (active/idle, locked/unlocked) rather than precise activity data, and is restricted to secure contexts (HTTPS). These measures prevent abusive fingerprinting or surveillance while enabling legitimate use cases.

With the native Idle Detection API, idle state is detected globally at the OS level, so it works reliably even when the tab is in the background. In fallback mode, however, browser throttling of timers in background tabs may delay or prevent accurate idle detection. The native API is significantly more reliable for cross-tab monitoring scenarios.

First, check for API availability with if ('IdleDetector' in window). Then request permission using await IdleDetector.requestPermission() inside a user gesture handler. Create a detector instance, start it with a threshold: await detector.start({ threshold: 60000 }), and listen for changes via detector.addEventListener('change', handler). Always provide a graceful fallback for unsupported browsers using event-based activity monitoring.