feat: add iOS-focused PWA shell with service worker and manifest
This commit is contained in:
parent
56b8825ca5
commit
fea5fe9cbb
9 changed files with 176 additions and 3 deletions
16
src/pwa.js
Normal file
16
src/pwa.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
(function () {
|
||||
if ("serviceWorker" in navigator) {
|
||||
window.addEventListener("load", () => {
|
||||
navigator.serviceWorker.register("/service-worker.js").catch(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
const isIos = /iphone|ipad|ipod/i.test(window.navigator.userAgent);
|
||||
const isStandalone =
|
||||
window.matchMedia("(display-mode: standalone)").matches || Boolean(window.navigator.standalone);
|
||||
const hintEl = document.getElementById("ios-install-hint");
|
||||
if (hintEl && isIos && !isStandalone) {
|
||||
hintEl.textContent = "Tipp: Über Teilen > Zum Home-Bildschirm hinzufügen für App-Modus auf iOS.";
|
||||
hintEl.classList.remove("hidden");
|
||||
}
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue