WakeLock

Draft
This page is not complete.

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.

Methods

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

Examples

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 low as battery
  console.log(`${err.name}, ${err.message}`);
}

Specifications

Specification Status Comment
Screen Wake Lock API
The definition of 'WakeLock' in that specification.
Editor's Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
WakeLock
Experimental
Chrome Full support 84Edge Full support 84Firefox No support NoIE No support NoOpera Full support YesSafari No support NoWebView Android Full support 84Chrome Android Full support 84Firefox Android No support NoOpera Android Full support YesSafari iOS No support NoSamsung Internet Android No support No
request
Experimental
Chrome Full support 84Edge Full support 84Firefox No support NoIE No support NoOpera Full support YesSafari No support NoWebView Android Full support 84Chrome Android Full support 84Firefox Android No support NoOpera Android Full support YesSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.