PWA Integration
This commit is contained in:
BIN
img/icon-192.png
Executable file
BIN
img/icon-192.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
img/icon-512.png
Executable file
BIN
img/icon-512.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 177 KiB |
@@ -12,6 +12,21 @@
|
||||
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet">
|
||||
<!-- Custom styles -->
|
||||
<link rel="stylesheet" href="../css/style.css">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/service-worker.js')
|
||||
.then(registration => {
|
||||
console.log('Service Worker registriert: ', registration);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('Service Worker Registrierung fehlgeschlagen: ', err);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
21
manifest.json
Executable file
21
manifest.json
Executable file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "DoMiLi",
|
||||
"short_name": "DoMiLi",
|
||||
"description": "Ihre App-Beschreibung hier.",
|
||||
"start_url": "index.php",
|
||||
"display": "standalone",
|
||||
"background_color": "#ffffff",
|
||||
"theme_color": "#212529",
|
||||
"icons": [
|
||||
{
|
||||
"src": "img/icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "img/icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
]
|
||||
}
|
||||
32
service-worker.js
Executable file
32
service-worker.js
Executable file
@@ -0,0 +1,32 @@
|
||||
const CACHE_NAME = 'domili-cache-v1';
|
||||
const urlsToCache = [
|
||||
'/',
|
||||
'/index.php',
|
||||
'/css/style.css',
|
||||
'inc/header.php',
|
||||
'inc/footer.php',
|
||||
'img/icon-192.png',
|
||||
'img/icon-512.png',
|
||||
'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css'
|
||||
];
|
||||
|
||||
self.addEventListener('install', event => {
|
||||
event.waitUntil(
|
||||
caches.open(CACHE_NAME)
|
||||
.then(cache => {
|
||||
return cache.addAll(urlsToCache);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', event => {
|
||||
event.respondWith(
|
||||
caches.match(event.request)
|
||||
.then(response => {
|
||||
if (response) {
|
||||
return response;
|
||||
}
|
||||
return fetch(event.request);
|
||||
})
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user