Screen Wake Lock

Prevent your screen from locking during presentations, reading, or any activity that requires your screen to stay active.

Wake Lock Control

This tool uses the Screen Wake Lock API to prevent your screen from turning off due to inactivity.

Status: Wake Lock is inactive

Wake Lock Code Example

Here's the JavaScript code that powers this wake lock functionality:

JavaScript - Screen Wake Lock Implementation
// Request wake lock async function requestWakeLock() { try { wakeLock = await navigator.wakeLock.request('screen'); // Update UI when wake lock is acquired lockStatus.textContent = 'Wake Lock is active'; lockStatus.className = 'px-3 py-1 rounded-md bg-green-100 text-green-800 font-medium'; requestButton.disabled = true; releaseButton.disabled = false; // Listen for wake lock release wakeLock.addEventListener('release', () => { console.log('Wake Lock was released'); updateUIOnRelease(); }); // Handle visibility changes document.addEventListener('visibilitychange', handleVisibilityChange); } catch (error) { console.error(`Failed to request Wake Lock: ${error.message}`); lockStatus.textContent = `Error: ${error.message}`; } } // Release wake lock function releaseWakeLock() { if (wakeLock) { wakeLock.release() .then(() => { wakeLock = null; updateUIOnRelease(); }); } } // Handle page visibility changes function handleVisibilityChange() { if (wakeLock !== null && document.visibilityState === 'visible') { // Re-request the wake lock when the page becomes visible again requestWakeLock(); } }

Windows Administrative Settings

To prevent Windows from locking your computer in an office environment, you should also:

  1. Open Control Panel by pressing Win+X and selecting "Control Panel"
  2. Go to System and Security > Power Options
  3. Click on "Change plan settings" for your current power plan
  4. Click on "Change advanced power settings"
  5. Expand "Display" and set "Turn off display after" to "Never"
  6. Expand "Sleep" and set "Sleep after" to "Never"
  7. Click Apply and OK

For Group Policy controlled environments (like many offices):

  1. Ask your IT administrator to modify the relevant Group Policy settings
  2. They may need to adjust the "Power Management" settings in Group Policy
  3. Common settings to modify include "Turn off display after", "Sleep after" and "Require a password on wakeup"

How This Works

The Screen Wake Lock API allows web applications to prevent devices from dimming or locking their screen when an application needs to keep running.

This is particularly useful for:

  • Presentations
  • Reading long articles
  • Navigation applications
  • Cooking recipes

Note: This API only works when the tab is active and visible. If you switch tabs or minimize the browser, the wake lock may be released.