From 64c07468d92db92991864f6f11a46f969758f3ed Mon Sep 17 00:00:00 2001 From: Florian Latapie <70631622+FlorianLatapie@users.noreply.github.com> Date: Sat, 6 Apr 2024 14:09:21 +0200 Subject: [PATCH] =?UTF-8?q?pourquoi=20ca=20marche=20pas=20d=C3=A9ploy?= =?UTF-8?q?=C3=A9=20=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PWA/index.html | 4 ++-- PWA/script.js | 2 ++ PWA/sw.js | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/PWA/index.html b/PWA/index.html index 6bafe2d..94d5509 100644 --- a/PWA/index.html +++ b/PWA/index.html @@ -33,9 +33,9 @@

Bienvenue dans l'installeur de FlorianLatapie/Config

- l’icône ci-dessous, + l'icône ci-dessous, - puis sur « Ajouter à l’écran d’accueil ». + puis sur « Ajouter à l'écran d'accueil ». diff --git a/PWA/script.js b/PWA/script.js index 3bed1aa..bca0e39 100644 --- a/PWA/script.js +++ b/PWA/script.js @@ -21,9 +21,11 @@ var isIOS = /Mac|iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream if (isIOS) { installBtn.style.display = "none"; iosText.style.display = "block"; + alert("ios"); } else { installBtn.style.display = "block"; iosText.style.display = "none"; + alert("not ios"); } let deferredPrompt; diff --git a/PWA/sw.js b/PWA/sw.js index 403d229..7fd8241 100644 --- a/PWA/sw.js +++ b/PWA/sw.js @@ -11,9 +11,15 @@ self.addEventListener('install', (e) => { ); }); - self.addEventListener('fetch', (e) => { - console.log(e.request.url); - e.respondWith( - caches.match(e.request).then((response) => response || fetch(e.request)), - ); - }); \ No newline at end of file +self.addEventListener('fetch', (e) => { + e.respondWith( + caches.match(e.request).then((response) => { + if (response) { + console.log(e.request.url); + return response; + } else { + return fetch(e.request); + } + }), + ); +}); \ No newline at end of file