Screen Wake Lock API

The Screen Wake Lock API lets a web page keep the display awake. Try it live below, then read how it works.

Ready. Choose a duration and press Start.

The Screen Wake Lock API is a web standard that lets a page request a 'screen' wake lock so the display does not dim or lock while the page is active.

It is the technology behind every no sleep page. Pressing Start below calls navigator.wakeLock.request('screen') and holds the lock until you stop or the tab is hidden.

How the API works

  1. 1

    Request a lock

    The page calls navigator.wakeLock.request('screen') after a user gesture.

  2. 2

    Hold while visible

    The lock stays active as long as the document is visible.

  3. 3

    Re-acquire on return

    On visibilitychange the page can request the lock again.

Frequently asked questions

How do I call the Screen Wake Lock API?

Use await navigator.wakeLock.request('screen') inside a user gesture, then keep a reference to the returned WakeLockSentinel.

Why does my wake lock get released?

The browser releases it when the tab becomes hidden, the device is locked, or battery saver kicks in. Listen for visibilitychange and re-request.

Is the API supported everywhere?

It is widely supported in Chromium browsers and recent Safari; always check support and provide a fallback.