Re: [w3c/manifest] Add a unique identifier for a PWA (#586)

Good question! I think it's easiest to think of these two categories of web apps:

### If you are creating an app from scratch (no existing installs to update)
`id` is just a string, like a UUID, that uniquely identifies the app on the start_url_origin

(at https://www.new-app.com/):
```
{
  ...
  id: "NewAppId",
  start_url: "/index.html", // <- updatable now :)
  ...
}
```
The global id evaluates to `https://www.example.com/` + `NewAppId` = `https://www.example.com/NewAppId`. This is not intended to be evaluate-able, but looks like a URL.


### If you have an existing app (installs exist where the manifest did NOT have an `id` set)
`id` should be the relative path of the `start_url` so that the new manifest (with `id` specified) will apply, and thus update, the old manifest.  EX:

old (at https://www.example.com/):
```
{
  ...
  start_url: "/index.html"
  ...
}
```
The default global id is: `https://www.example.com/index.html`

new: 
```
{
  ...
  id: "index.html",
  start_url: "/index.html", // <- now this is updatable!
  ...
}
```
The global id evaluates to `https://www.example.com/` + `index.html` = `https://www.example.com/index.html`, thus matching the old manifest.

Hopefully that makes sense?



-- 
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/586#issuecomment-801286899

Received on Wednesday, 17 March 2021 17:51:18 UTC