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

The WakeLock interface of the Screen Wake Lock API prevents device screens from dimming or locking when an application needs to keep running.

The system wake lock is exposed through the global Navigator.wakeLock property.

Instance methods


Requests a WakeLockSentinel object, which returns a Promise that resolves with a WakeLockSentinel object.


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


try {
  const wakeLock = await navigator.wakeLock.request("screen");
} catch (err) {
  // the wake lock request fails - usually system related, such being low on battery
  console.log(`${err.name}, ${err.message}`);


Screen Wake Lock API
# the-wakelock-interface

Browser compatibility

BCD tables only load in the browser