Re: [w3c/manifest] Control which parts of the URLs belong to the app and which parts are not (#996)

### My Test
I did some tests, focusing on how to control the install icon and launch icon in the address bar.

Assuming that service worker's scope is `/`, thus it can control all URLs.  **But `/manifest.json` scope is `/app`.**

| URL(File) | Show Install Icon(before install) | Show Launch Icon(after install) |
| --- | --- | --- |
|  `index.html` include `manifest.json` | Yes | No |
|  `index.html` **not** include `manifest.json` | No | No |
|  `app.html` include `manifest.json` | Yes | Yes |
|  `app.html` **not** include `manifest.json` | No | Yes |
|  `app.js` or `app.css` | No | Yes |
|  `app.js` or `app.css` if manifest's scope is **`/app.html`** | No | No |

### My Goal
index.html must show the install icon, but don't show the launch icon because it is a landing page(not the app itself). And app.html can show both install icon and launch icon. The launch icon should only appear for app files, don't appear for other files(like index.html and app.js). 

### My Conclusions
Browser use manifest file to determines whether the install icon will appear, regardless of whether current URL is in the manifest's scope or not.

Browser use string prefix matching (like `url.startsWith(manifest-scope)`) determines whether the launch icon will appear. So if the app is a multiple files app(not single file app), all app files should have a same and unique prefix.

@alancutter Could you confirm that the spec can guarantee these?

@tomayac I rarely see articles or documents that explicitly say these. I think developers might be interested in these knowledge.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/996#issuecomment-901948013

Received on Thursday, 19 August 2021 14:10:02 UTC