PWA: a home-screen install from ?parentMode=1 keeps parent mode

iOS starts an installed web app at the manifest's start_url ("/"), so the
query parameter was dropped. Opened with ?parentMode=1, the page now points at
a second manifest whose start_url keeps it, and names the app "Musik Eltern".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 17:19:42 +02:00
parent 17db811bba
commit 8ddfafebcb
2 changed files with 47 additions and 1 deletions

View File

@@ -15,10 +15,23 @@
<meta name="theme-color" content="#0d2f3c" /> <meta name="theme-color" content="#0d2f3c" />
<meta name="description" content="Musik und Hörbücher für die MusicMouse" /> <meta name="description" content="Musik und Hörbücher für die MusicMouse" />
<!-- iOS does not read the manifest for home-screen installs; these are what it uses. --> <!-- iOS takes start_url from the manifest, but the title, icon and status bar from
these tags. -->
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" /> <meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="Musik" /> <meta name="apple-mobile-web-app-title" content="Musik" />
<!-- A home-screen install starts at the manifest's start_url, not at the address it
was added from, so `?parentMode=1` would be lost. Opened with it, the page offers
a second manifest whose start_url keeps it - "Add to Home Screen" from a parent's
URL installs the parents' app, under its own name. Inline, so the tags are
switched before anything reads them. -->
<script>
if (new URLSearchParams(location.search).get("parentMode") === "1") {
document.querySelector('link[rel="manifest"]').href = "/manifest-parents.webmanifest";
document.querySelector('meta[name="apple-mobile-web-app-title"]').content = "Musik Eltern";
document.title = "Musik Delfin Eltern";
}
</script>
<!-- An opaque status bar, so the page starts below it - not black-translucent. That <!-- An opaque status bar, so the page starts below it - not black-translucent. That
one ran the page under the clock, which put every top-anchored control behind one ran the page under the clock, which put every top-anchored control behind
it unless each remembered its inset, and since iOS 26 it also sizes the app one it unless each remembered its inset, and since iOS 26 it also sizes the app one

View File

@@ -0,0 +1,33 @@
{
"name": "Musik Delfin Eltern",
"short_name": "Musik Eltern",
"description": "Musik und Hörbücher für die MusicMouse",
"start_url": "/?parentMode=1",
"scope": "/",
"display": "standalone",
"orientation": "any",
"background_color": "#0d2f3c",
"theme_color": "#0d2f3c",
"lang": "de",
"icons": [
{
"src": "/icon-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icon-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icon-maskable-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
],
"id": "/?parentMode=1"
}