Web APIs

Screen Wake Lock API

Checking compatibility...

Prevent devices from dimming or locking the screen when an application needs to keep running. Perfect for reading, presentations, or applications that don't require user interaction.

Basic Wake Lock

Keep the screen on with a simple button click. This example shows how to prevent a device from dimming or locking its screen, which is useful for reading apps, navigation tools, or presentation software.

=
=
=
=
=
=

Output

Click Run to see output...

Automatic Release

Handle situations when the screen lock is automatically released. This example shows how to detect when a user switches tabs or minimizes the browser, and how to reactivate the wake lock when they return to your app.

=
=
=
=
=
=

Output

Click Run to see output...