malko
malko

Reputation: 2382

Is there a way to keep screen awake in a progressive-web-app?

I plan to make a progressive web app to display the time remaining in a meeting. I need this to keep the display always on. Is there any way for a progressive web app to avoid screen to go to sleep and blank ?

Upvotes: 25

Views: 11587

Answers (2)

Ben in CA
Ben in CA

Reputation: 851

Here's the documentation for the Wake Lock option in Chrome: https://developer.chrome.com/articles/wake-lock/

Note that it's only available on HTTPS. (Normally not an issue, although some non-public internal applications can be standard HTTP.)

Upvotes: 2

Kevin Farrugia
Kevin Farrugia

Reputation: 7449

Update July 2020: Chrome 84 now ships with the Wake Lock API https://www.chromestatus.com/feature/4636879949398016 which can be used to prevent the screen from turning off.


You could use the Standby API however support is still limited.

Then there are hacks such as playing a video infinitely or the nosleep script, however from my experience they don't work consistently either.

Upvotes: 17

Related Questions