admin管理员组文章数量:1327308
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
1 Answer
Reset to default 8https://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
版权声明:本文标题:javascript - Keep phone screen on with PWA (progressive web app) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742202231a2432176.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论