composer/projects/hi3516ev300_lite_meldana/general/overlay/var/www/wait.html

60 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1" name="viewport">
<title>Пожалуйста подождите.... Идёт загрузка</title>
<style>
body {
text-align: center;
padding: 1vh;
}
h1 {
font-size: 10vw;
line-height: 1;
}
h3 {
font-size: 5vw;
line-height: 1;
}
progress {
width: 90%;
}
</style>
</head>
<body>
<main>
<h1>Мелдана</h1>
<h3>Перезагрузка... Пожалуйста подождите...</h3>
<progress max="15" value="0"></progress>
</main>
<script>
const u = window.location.protocol + '//' + window.location.host;
const p = document.querySelector('progress');
let s = 0;
function t() {
s += 1;
p.value = s;
(s === p.max) ? g() : setTimeout(t, 1000);
}
function g() {
(async () => {
await fetch(u, {method: 'HEAD', mode: 'no-cors'}).then(() => {
window.location.replace(u);
}).catch(() => {
s = 0;
setTimeout(t, 1000);
})
})()
}
setTimeout(t, 1000);
</script>
</body>
</html>