diff --git a/client/index.html b/client/index.html index c5942b0..8920347 100644 --- a/client/index.html +++ b/client/index.html @@ -44,6 +44,11 @@ + @@ -173,6 +178,11 @@ + + + + + diff --git a/client/scripts/ui.js b/client/scripts/ui.js index 970660b..7639ea1 100644 --- a/client/scripts/ui.js +++ b/client/scripts/ui.js @@ -527,6 +527,17 @@ if ('serviceWorker' in navigator) { window.addEventListener('beforeinstallprompt', e => { if (window.matchMedia('(display-mode: standalone)').matches) { return event.preventDefault(); + } else { + const deferredPrompt = e; + const btn = document.querySelector('#install') + btn.hidden = false; + btn.onclick = _ => { + deferredPrompt.prompt(); + // Wait for the user to respond to the prompt + deferredPrompt.userChoice.then((resp) => { + console.log(JSON.stringify(resp)); + }); + } } }); }