Re: [w3c/manifest] Remove the default value for start_url (#670)

@pkotwicz:
> I think the default start_url should be the origin of the manifest
> Rationale:
> When a user chooses to add a site to their home screen, the browser should try to give the user best possible experience. If the Web Manifest does not provide a start_url, in my opinion, "the best possible experience" is a start_url which is least likely to be a 404.

(I'll refer to your proposal as being that the default start_url is "/", as opposed to mine where it is ".".)

Let's cover the most common cases for an app directory hierarchy:

* a) Most common: A start page at the top level domain, with a manifest in the top level directory: e.g., the start page is "https://example.com/" and the manifest is at "https://example.com/manifest.json".
* b) The start page is at the top level, with the manifest in a subdirectory: e.g., start page is "https://example.com/" and the manifest is at "https://example.com/assets/manifest.json".
* c) The entire app is in a subdirectory, with the manifest in that same directory: e.g., start page is "https://example.com/myapp/" and the manifest is at "https://example.com/myapp/manifest.json".
* There are even rarer cases, such as having manifest off-origin, which don't make sense to handle with the default.

So (a) will be covered no matter whether the default is "/" or ".", and that's the most important. A default of "/" covers (b) but not (c). A default of "." covers (c) but not (b).

So I can see arguments for and against "/" and "." being the default. However, I don't think (b) is necessarily more common than (c); I'd guess they're within the same order of magnitude, with (a) an order of magnitude more common than either of them.

I have two main arguments for "." over "/":

1. All explicit URLs in the manifest spec are resolved relative to the manifest URL: `scope`, `start_url`, `src` (of `icons` and `screenshots`), `src` and `scope` of a `serviceworker`. It makes sense for the defaults to also be relative to the manifest URL.
2. By having the default be relative to the manifest URL, the app's directory hierarchy is "portable" in that it can be moved between directories. You can pick up the entire directory tree and move it into a sub-directory and things will keep working, which is true of the entire web platform unless path-absolute URLs are used.

I don't think it matters particularly much, but those two reasons cause me to lean towards "." instead of "/".

Finally, I don't think we should be looking at this "probabilistically" (you used the phrase "which is least likely to be a 404"). Since, at least, Chrome does not currently honour a manifest without a `start_url`, we aren't breaking existing site expectations. Since no existing site will break, it isn't necessary to try and maximize the number of situations in which the default is appropriate (it doesn't matter if 10% of sites can use the default and 90% have to specify it explicitly). Consistency / logic is more important than sheer numbers.

> Here's an example Web Manifest in the wild which does not have a start_url (and has display=standalone) where a default start_url of "." would result in a 404.
> https://weather.com/weather/assets/manifest.507fcb498f4e29acfeed7596fe002857.json
> https://weather.com/weather/assets/ is a 404.

Yep, that's an example of (b). But there are also lots of others of case (c), notably *every* PWA hosted on github.io, since your app needs to be hosted in a sub-directory (an example I just found: https://gauravchl.github.io/secure-wallet/).

-- 
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/pull/670#issuecomment-391186524

Received on Wednesday, 23 May 2018 00:55:22 UTC