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.
The page calls navigator.wakeLock.request('screen') after a user gesture.
The lock stays active as long as the document is visible.
On visibilitychange the page can request the lock again.
Use await navigator.wakeLock.request('screen') inside a user gesture, then keep a reference to the returned WakeLockSentinel.
The browser releases it when the tab becomes hidden, the device is locked, or battery saver kicks in. Listen for visibilitychange and re-request.
It is widely supported in Chromium browsers and recent Safari; always check support and provide a fallback.