WakeLock: request() method

Baseline 2025
Newly available

Since March 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The request() method of the WakeLock interface returns a Promise that fulfills with a WakeLockSentinel object if the system screen wake lock is granted.

The screen wake lock prevents device screens from dimming or locking when an application needs to keep running.

Syntax

js
request(type)

Parameters

type Optional

A string specifying the screen wake lock type, from among the following enumerated types:

screen

Prevents the screen from turning off. Only visible documents can acquire the screen wake lock.

If no type parameter is explicitly specified, the request() method defaults to using the screen type.

Return value

A Promise that resolves with a WakeLockSentinel object.

Exceptions

NotAllowedError DOMException

Thrown when wake lock is not available, which can happen because:

  • Use of this feature is blocked by a Permissions Policy.
  • The document is not fully active.
  • The document's visibility state is hidden.
  • The User Agent could not acquire platform's wake lock. For example, this might happen if the device is low on battery.

Examples

The following asynchronous function requests a WakeLockSentinel object. The request() method is wrapped in a try...catch statement to handle cases where the browser refuses the request for any reason.

js
const requestWakeLock = async () => {
  try {
    const wakeLock = await navigator.wakeLock.request("screen");
  } catch (err) {
    // The wake lock request fails - usually system-related, such as low battery.

    console.log(`${err.name}, ${err.message}`);
  }
};

requestWakeLock();

The screen wake lock may be revoked by the device after it has been granted. The returned WakeLockSentinel can be used to check the status of the lock, and/or to manually cancel a held screen wake lock.

Specifications

Specification
Screen Wake Lock API
# the-request-method

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
request
Chrome – Full support
Chrome 84 (Release date: 2020-07-27)
footnote Full support
Edge – Full support
Edge 84 (Release date: 2020-07-16)
footnote Full support
Firefox – Full support
Firefox 126 (Release date: 2024-05-14)
footnote Full support
Opera – Full support
Opera 70 (Release date: 2020-07-27)
footnote Full support
Safari – Full support
Safari 16.4 (Release date: 2023-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 84 (Release date: 2020-07-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 126 (Release date: 2024-05-14)
footnote Full support
Opera Android – Full support
Opera Android 60 (Release date: 2020-09-23)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 16.4 – 18.3 (Release date: 2023-03-27)
footnote Partial support
footnote Does not work in standalone Home Screen Web Apps. See bug 254545.
Safari on iOS – Full support
Safari on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
Samsung Internet – Full support
Samsung Internet 14 (Release date: 2021-04-17)
footnote Full support
WebView Android – Full support
WebView Android 84 (Release date: 2020-07-27)
footnote Full support
WebView on iOS – Partial support
WebView on iOS 16.4 – 18.3 (Release date: 2023-03-27)
footnote Partial support
footnote Does not work in standalone Home Screen Web Apps. See bug 254545.
WebView on iOS – Full support
WebView on iOS 18.4 (Release date: 2025-03-31)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Has more compatibility info.

See also