If you've used KeepAwake or researched browser-based keep-awake tools, you've probably seen the term "Wake Lock API." It's the technical foundation behind the most reliable browser method for preventing your computer from sleeping โ but how it actually works is rarely explained in plain terms. Here's the full story.
What Is the Screen Wake Lock API?
The Screen Wake Lock API is a web standard published by the W3C (the organization that defines how web browsers work). It allows a web page running in a browser to make a formal request to the operating system to suppress its screen sleep and idle detection mechanisms.
In plain English: it's a standardized way for a website to say to Windows or macOS, "please don't let the screen go dark or let the system mark itself as idle while this page is active." The OS listens to this request and complies โ the same way it does for Netflix when you're watching a movie, or for a video conferencing app during a call.
The API Request in Practice
From a developer's perspective, requesting a Wake Lock looks like this in JavaScript:
const wakeLock = await navigator.wakeLock.request('screen');
That single line, when executed in a browser that supports the API, tells the operating system to keep the screen active. The OS responds by suspending its idle and sleep timers for the requesting application. When the page releases the lock (or is closed), the OS resumes normal sleep behavior.
The key word is "screen" โ the Wake Lock API currently only supports screen wake locks (as opposed to system wake locks that would prevent CPU sleep entirely). For the purpose of keeping Teams active, a screen wake lock is exactly what's needed: it prevents the display from going dark, which prevents the OS from marking the system as idle, which prevents Teams from switching to Away.
Why This Works When JavaScript Mouse Events Don't
A common misconception is that any JavaScript running on a web page can simulate mouse activity. Many simpler browser scripts dispatch mousemove events in JavaScript โ but these events stay within the browser's own event system. They don't reach the Windows GetLastInputInfo() API, which only tracks genuine hardware input from physical devices.
Wake Lock bypasses this problem entirely. Instead of trying to simulate hardware input, it makes a system-level request to suppress the idle check altogether. The OS honors this request because it comes through a legitimate web standard channel โ the same channel used by media players, video conferencing apps, and presentation tools.
This is a fundamental architectural difference, not just a quality difference. Mouse event simulation works around the problem; Wake Lock solves it at the source.
Browser Support in 2025
Chrome and Edge (Chromium-based): Full support since Chrome 84 and Edge 84 (mid-2020). This covers the vast majority of corporate and personal Windows browsers. Chromium-based browsers are used by roughly 65% of all internet users.
Firefox: Support was added in Firefox 126 (2024) behind a flag, and became default in subsequent versions. Firefox users on recent versions have full Wake Lock support.
Safari: Safari on macOS added Wake Lock support in Safari 16.4 (2023). On iOS and iPadOS, support is present but behavior can vary due to power management constraints on mobile devices.
For the common corporate scenario of Windows + Chrome or Edge, Wake Lock works completely and reliably. KeepAwake detects Wake Lock availability on load and displays the status in the technique dashboard โ if it shows "Active" next to Wake Lock, your OS is receiving the lock request.
What Happens When Wake Lock Is Active
When Wake Lock is successfully acquired:
- The OS display sleep timer is suppressed โ your screen won't dim or turn off
- The OS idle timer continues counting, but the system does not transition to the low-power idle state that triggers Teams' Away detection
- Screen savers are suppressed
- The system remains fully responsive, at normal performance levels
- Teams, Slack, Zoom, and other applications that read OS presence state see the system as active
The Wake Lock does not prevent manual sleep (pressing the power button, closing a laptop lid, or pressing Windows + L). It only suppresses automatic system-initiated sleep. This is intentional โ it gives you control when you want to step away, while preventing the accidental idle transitions that happen during focused work.
Wake Lock and Battery Life
A reasonable concern: does keeping the screen active drain the battery faster? The answer is yes, but by less than you might expect. The screen itself is one of the larger power consumers on a laptop, but modern displays use adaptive brightness and efficient panels. The main power impact is that the display stays fully on rather than dimming.
For users on battery, KeepAwake's Wake Lock automatically releases if the tab is hidden and the battery drops below a threshold, or if the user manually reduces brightness. The goal is to keep Teams active, not to maximize screen brightness unnecessarily.
The Backup Techniques: Why Five Is Better Than One
Wake Lock is the primary technique, but KeepAwake runs four additional techniques simultaneously. This matters because:
- In browsers without Wake Lock support, Picture-in-Picture video provides OS-level media playback signaling that achieves a similar effect
- Web Worker heartbeat timers run in a background thread immune to browser tab throttling, maintaining activity even after long backgrounding
- AudioContext creates an active audio session, which many operating systems treat as ongoing activity
- Canvas animation provides a baseline activity signal for environments where other techniques are restricted
Together, these techniques cover the full matrix of browser versions, operating systems, and corporate configurations โ so the practical result is the same regardless of your specific environment.