admin管理员组

文章数量:1326322

I built a fitness "progressive" web app that you can add to your phone home screen. It guides the user through a 7 minute workout.

Is there any way to keep the screen "awake" so the user doesn't have to keep ing back to the phone to turn it on? Another drawback to the screen sleeping is the javascript timer stops, ruining the workout timing.

I built a fitness "progressive" web app that you can add to your phone home screen. It guides the user through a 7 minute workout.

Is there any way to keep the screen "awake" so the user doesn't have to keep ing back to the phone to turn it on? Another drawback to the screen sleeping is the javascript timer stops, ruining the workout timing.

Share Improve this question asked Jan 30, 2018 at 3:33 patmoodpatmood 1,5851 gold badge12 silver badges15 bronze badges 1
  • Possible duplicate of Can I prevent phone from sleep on a webpage – Venryx Commented Jul 29, 2019 at 2:32
Add a ment  | 

1 Answer 1

Reset to default 8

https://www.w3/TR/wake-lock/

https://developer.mozilla/en-US/docs/Archive/B2G_OS/API/Wake_Lock_API

Basically, yes, there is such a thing as a website forcing the screen to stay awake, but it is non-standard currently. It may bee standard but right now it seems to only work on FirefoxOS. This is however to be the intended way to achieve wake locking in javascript.

Another solution though that's more of a hack is doing something along the lines of playing a hidden video in the background since as far as i know most browsers stay awake if a video is playing.

本文标签: javascriptKeep phone screen on with PWA (progressive web app)Stack Overflow