~ 1 min read

Super easy way to prevent your computer from sleeping

If you need to make sure your comouter doesn’t go to sleep, with the recent addition of wakelock to Chrome this is extremely easy to do.

Open Chrome on any page

Open the developer tools:

Ctrl+Shift+C on Windows/Linux
⌘ +⇧+C on Mac (Cmd+Shift+C)

will open the dev tools - then go to the “Console” tab and paste/type this into the console

let screenLock = await navigator.wakeLock.request('screen');

That’s it. Your computer won’t sleep.

Note that you will lose the lock if you clos or change the tab.