Screen Wake Lock support
Published
The Screen Wake Lock API lets a page request that the device’s screen stay on and not dim or lock. The browser releases the lock automatically once the document becomes hidden, so a page must reacquire it after the user returns.
Browser & ecosystem support
Section titled “Browser & ecosystem support”- Legend
- Yes
- Partial
- Flag
- No
- Unknown
| Browser / Platform | Support | Versions | Confidence | Source | Notes |
|---|---|---|---|---|---|
| Chrome (Desktop) | Yes | 84 | high | source | — |
| Chrome (Android) | Yes | 84 | high | source | 1 |
| Edge (Desktop) | Yes | 84 | high | source | 2 |
| Firefox (Desktop) | Yes | 126 | high | source | — |
| Firefox (Android) | Yes | 126 | high | source | 3 |
| Safari (macOS) | Yes | 16.4 | high | source | — |
| Safari (iOS) | Partial | 16.4 → 18.4 | high | source | 4 |
| Samsung Internet | Yes | 14.0 | high | source | 5 |
| WebView (Android) | Yes | 84 | high | source | 6 |
| Opera | Yes | 73 | low | source | — |
- Derived by browser-compat-data mirroring from Chrome.
- Derived by browser-compat-data mirroring from Chrome.
- Derived by browser-compat-data mirroring from Firefox.
- Does not work in standalone Home Screen Web Apps. See bug 254545 (https://webkit.org/b/254545#c32).
- Derived by browser-compat-data mirroring from Chrome Android.
- Derived by browser-compat-data mirroring from Chrome Android.
How to use it
Section titled “How to use it”Request a 'screen' wake lock and keep a reference to the returned
WakeLockSentinel so it can be released later:
let wakeLock = null;
async function requestWakeLock() { wakeLock = await navigator.wakeLock.request('screen'); wakeLock.addEventListener('release', () => { wakeLock = null; });}Release it explicitly once the screen no longer needs to stay on:
async function releaseWakeLock() { if (wakeLock) { await wakeLock.release(); wakeLock = null; }}How to detect it at runtime
Section titled “How to detect it at runtime”Check for wakeLock on navigator before calling request(). When it is
absent, fall back to whatever the app already does without a wake lock (for
example, leaving the screen’s default timeout in place):
async function keepScreenAwake() { if (!('wakeLock' in navigator)) { console.warn('Screen Wake Lock not supported; screen may still dim.'); return null; } try { return await navigator.wakeLock.request('screen'); } catch (err) { console.warn(`Wake lock request failed: ${err.message}`); return null; }}Practical checklist
Section titled “Practical checklist”- When the document’s visibility state becomes
hidden, the browser releases the lock and fires areleaseevent on theWakeLockSentinel; listen forvisibilitychangeand re-request the lock when the document becomes visible again. - The cited MDN compatibility data records support in Firefox from version 126, Chrome from version 84, and Safari from version 16.4, so run the feature check below rather than assuming availability from a browser name alone.
- The cited MDN compatibility data records Safari on iOS 16.4 to before 18.4 as a partial implementation because it does not work in standalone Home Screen web apps; it records support from Safari on iOS 18.4.
request()rejects when the document is not fully active or its visibility state ishidden, so only call it once the page is confirmed visible.
Where to go next
Section titled “Where to go next”- Contact Picker — another capability gated on transient user activation.
- Background Fetch
← Back to the Compatibility explorer.