Google Chrome developers have added an intent to experiment with a feature that enables web applications to keep systems awake even in lack of mouse or keyboard activity.

This is to be achieved through the WakeLock API, which allows requesting a wake lock that prevents devices from entering a power-saving state by lowering the screen brightness, turning off the screen, or reduce CPU cycles.

Experimenting with the new feature is intended for Google Chrome 78 through 80 and the code for doing this is already available.

Benefits of Wake Lock

The way a webpage would use this API is to make a request when it is visible to prevent the system from automatically locking or turning off the display. Uses could "override the lock by switching to another tab or manually locking or powering off their display," says Google developer Reilly Grant.

The motivation behind the desire to implement this feature is to enable new experiences that currently need a native app. Some applications that would benefit from keeping the system awake are navigation screens, reading an ebook, following recipes, or tasks that need to finish longer computations.

Another reason is to provide a secure and safe way to achieve the result, as web developers needing this functionality turn to workarounds that may pose a security risk or increase power usage - e.g. embedding a low-key video element that plays in a loop for a defined time.

The WakeLock API specification is currently in an experimental stage and developers implementing it should be aware that changes may lead to incompatibility problems.

The intent to implement this feature in Google Chrome has existed since April 2018, after the second iteration of the Wake Lock API.

For the moment, the goal is to receive feedback from developers "on the shape of the API and whether the “screen wake lock” subset of the full specification is sufficient for their use cases."

If tests are successful, the support for the feature is planned for Windows, Mac, Linux, Chrome OS, Android.

Abuse possibilities

If the feature makes it in Chrome, some wrinkles need to be ironed out and the potential for abuse needs to be reduced.

For instance, it does not look like there will be any permissions or notifications in the experimental phase to alert the user of the awake state of the system as long as the page is in the foreground.

Also, there is room for abuse in that a page may not release the request to keep the system awake. This would impact battery and power usage.

Moreover, cryptomining operations could see this as an opportunity to keep the activity going; real-time tracking is another risk, as threat actors could use the feature to monitor movement even when the target turns off the screen.