Files
flutter/web/index.prod.html
T
Ruslan Bakiev fca8004e8d
Build and deploy Flutter Web / build (push) Failing after 4m19s
Add web service worker loader
2026-06-21 09:34:40 +07:00

96 lines
2.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<base href="/" />
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="MapFlow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#0d1b2a">
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="MapFlow">
<link rel="apple-touch-icon" href="icons/Icon-192.png?v={{sw_version}}">
<link rel="icon" type="image/png" href="favicon.png?v={{sw_version}}"/>
<title>MapFlow</title>
<link rel="manifest" href="manifest.json">
<style>
#sw-loading .sw-title,
#sw-loading .sw-status,
#sw-loading .sw-percentage {
display: none !important;
}
#sw-loading {
background: #0d1b2a !important;
gap: 0 !important;
}
</style>
</head>
<body>
<script>
if ('serviceWorker' in navigator) {
var refreshing = false;
navigator.serviceWorker.addEventListener('controllerchange', function () {
if (refreshing) {
return;
}
refreshing = true;
window.location.reload();
});
window.addEventListener('sw-update-available', function () {
navigator.serviceWorker.getRegistration().then(function (registration) {
if (registration && registration.waiting) {
registration.waiting.postMessage({ type: 'skipWaiting' });
}
});
});
window.addEventListener('load', function () {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
registrations.forEach(function (registration) {
var worker = registration.active || registration.waiting || registration.installing;
var workerPath = worker ? new URL(worker.scriptURL).pathname : '';
if (worker && !workerPath.endsWith('/sw.js')) {
registration.unregister();
}
});
});
if (window.caches) {
caches.keys().then(function (keys) {
keys.forEach(function (key) {
if (
key === 'flutter-app-cache' ||
key === 'flutter-temp-cache' ||
key === 'flutter-app-manifest'
) {
caches.delete(key);
}
});
});
}
});
}
</script>
<script
defer
data-sw-bootstrap
src="bootstrap.js"
data-config='{
"logo": "icons/Icon-192.png?v={{sw_version}}",
"theme": "dark",
"color": "#46d3b1",
"showPercentage": false
}'
></script>
</body>
</html>