Search code examples
javascriptwindowsgoogle-chromemicrosoft-edgeweb-wake-lock

Javascript Screen WakeLock API does not work on Windows


The following demo works well on Android and IIRC used to work on Windows but now doesn't.

Can anyone else get the screen to stop going to sleep on Windows Chrome, Edge, or Opera?


Solution

  • After some testing, I guess you may have configured the power settings, so it does not work. But I think this is wrong. I think what you are describing should be the screen saver after Windows has not been operated for a period of time, not sleep.

    Please try the following steps (reset your power settings, you can choose to set it to never: both display and sleep):

    1. Right-click on the blank part of the desktop to select personalization
    2. Select the Lock Screen tab
    3. Click Screen saver settings
    4. Set the required waiting time and apply
    5. Retest the Wake lock API. It worked for me.