Screen Wake Lock API In JavaScript

Screen Wake Lock API In JavaScript

A browser API to prevent the screen from dimming, sleeping or locking automatically,

This feature is very useful for application like timers, voice based application, live score updates, video players ... etc which don't want the screen to be auto locked.

Note that there are some cases when the lock is removes automatically

  • When the user navigate away from the tab
  • The user manually locks the screen
let screenLock = await navigator.wakeLock.request('screen');

await lock.release();

Supported only in Chrome and Edge Currently.