Info goes here
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Stay Awake</title>
</head>
<body>
<h1>Stay Awake Mode</h1>
<p>This page will try to keep your device awake while open.</p>
<script>
let wakeLock = null;
async function requestWakeLock() {
try {
if ('wakeLock' in navigator) {
wakeLock = await navigator.wakeLock.request('screen');
console.log('Wake lock is active.');
wakeLock.addEventListener('release', () => {
console.log('Wake lock was released.');
});
} else {
console.log('Wake Lock API not supported in this browser.');
}
} catch (err) {
console.error(`${err.name}, ${err.message}`);
}
}
document.addEventListener('visibilitychange', async () => {
if (wakeLock !== null && document.visibilityState === 'visible') {
await requestWakeLock();
}
});
requestWakeLock();
</script>
</body>
</html>