debugging PWA
This commit is contained in:
parent
0099edf95c
commit
9cda1eb6a5
1 changed files with 10 additions and 0 deletions
10
index.html
10
index.html
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue