debugging PWA

This commit is contained in:
Tobi 2024-04-09 10:48:14 +02:00
parent 0099edf95c
commit 9cda1eb6a5

View file

@ -162,11 +162,21 @@
}); });
} }
// Show installation instructions only if accessed via browser
if (window.matchMedia('(display-mode: browser)').matches) {
document.getElementById('install-instructions').style.display = 'block';
}
// Hide installation instructions once installed as standalone PWA // Hide installation instructions once installed as standalone PWA
window.addEventListener('beforeinstallprompt', (event) => { window.addEventListener('beforeinstallprompt', (event) => {
event.preventDefault(); // Prevent default browser prompt event.preventDefault(); // Prevent default browser prompt
document.getElementById('install-instructions').style.display = 'none'; document.getElementById('install-instructions').style.display = 'none';
}); });
// Check if launched from home screen and hide instructions
if (window.matchMedia('(display-mode: standalone)').matches) {
document.getElementById('install-instructions').style.display = 'none';
}
</script> </script>
</body> </body>
</html> </html>