There is an explicit section match-service-worker-registration defining how nestedly scoped service workers work, where a SW with longest scope_url would "override" all the others:
- Set matchingScopeString to the longest value in scopeStringSet which the value of clientURLString starts with, if it exists.
But of web app manifest, how nestedly scoped web app (manifest) effect with each other? Taking / and /sub-app/ as an example, is the one with shorter path (which has a wider scope) totally bypassed? OR the longer-path one (the sub one) can inherit all missing members from the shorter/parent one? There seems no definition exist about this scenarios in the current spec.
Furthermore, there might exist some scenarios that a /sub-app/ want treat / as sort of "parent app", where the sub-app can be navigated to from the "parent app" (in current browsing context) but has its own needs for a separated manifest (e.g. different themes/bg colors, different orientation, different desceiption etc. I think It's common?), thus should allow the navigation back from sub-app to "parent app".
There might be more complicated scenarios in practice, I believed It's worth discussion ;)
This is the first I'm hearing of potentially nested manifests.
Is this a theoretical question or are there examples of sites that implement this functionality? Are there web browsers / user agents that support such functionality?
Considering a complex web app manifest is still a relatively small JSON file with around a dozen top-level members, I wonder how much demand there is for something like this.
Well, let's take Alibaba as a example.
You might have heard about Alibaba's Taobao.com? The biggest e-commerce site of China.
The URL of Taobao mobile web app is h5.m.taobao.com/;
In the meantime, a separate web app named AliTrip is under h5.m.taobao.com/trip/home/ ;
Moreover, some sub-apps of Alitrip are under h5.m.taobao.com/trip/whatever/ ;
What if Taobao and Alitrip want to build their own PWA without altering the domains? And what if users want to add those sub-apps of AliTrip independently? (I mean, they are hotel booking, airplane ticketing thus It totally make sense.) That will make nested manifests happen.
That sounds a bit like Android apps being able to add multiple different home screen icons (still only one icon in launcher) for shortcuts into the apps, like for chats with a specific friends, weather for Google search, my apps for Google Play etc
@Paul_Kinlan ^
This seems somewhat similar to the challenge(s) described with multiple scopes in #449
In the case @Huxpro describes, I'm thinking:
"scope":"h5.m.taobao.com/"
"start_url":"h5.m.taobao.com/"
"scope":"h5.m.taobao.com/trip/"
"start_url":"h5.m.taobao.com/trip/home/"
"scope":"h5.m.taobao.com/trip/whatever/"
"start_url":"h5.m.taobao.com/trip/whatever/"
If there was shared content or a shared log-in page that resided on the root h5.m.taobao.com, that the AliTrip PWA or the AliTrip "sub-app" PWA needed, issue #449 would enable adding that (ex: h5.m.taobao.com/login) as an additional scope.
@RobDolinMS Yep, glad to see the discussion!
I think the feature I mainly requested is pretty similar to
In another case, a web app (scope:Chat.Example.com) might have peer subdomains that are in-scope (scope:Music.Example.com and scope:Video.Example.com) but might also have peer domains that are out-of-scope (scope:Events.Example.com)
but focus on paths instead of subdomains. If we take something similar to the proposal of exclude from @benfrancis the manifests might look like:
"scope":"h5.m.taobao.com/"
"scope_exclude": ["/trip"],
"start_url":"h5.m.taobao.com/"
鈥渟tay_in_app": ["http://login.taobao.com"]
"scope":"h5.m.taobao.com/trip/"
"scope_exclude": ["/sub-app1", "/sub-app2"],
"start_url":"h5.m.taobao.com/trip/home/"
鈥渟tay_in_app": ["http://login.taobao.com"]
"scope":"h5.m.taobao.com/trip/sub-app*/"
"start_url":"h5.m.taobao.com/trip/sub-app*/"
鈥渟tay_in_app": ["http://login.taobao.com"]
In this case, the Alitrip sub-app PWAs could be separated from Alitrip PWA and AliTrip PWA could be separated from Taobao PWA. The browsers could open a new browsing context when navigating to Alitrip from Taobao PWA and vice versa.
But It is still kinda verbose and is slightly different from subdomains' issues cuz the path could be nested. Thus I do think taking advantages of allowing overriding might solve problems better.
For example, we could define some override rules like service workers: the manifest from longer path (a.k.a subManifest) always extend the one from shorter path (a.k.a superManifest):
In this case the manifests might look like:
"scope":"h5.m.taobao.com/"
"start_url":"h5.m.taobao.com/"
鈥渟tay_in_app": ["http://login.taobao.com"]
"theme_color": "orange"
"scope":"h5.m.taobao.com/trip/"
"start_url":"h5.m.taobao.com/trip/home/"
"theme_color": "blue"
"scope":"h5.m.taobao.com/trip/sub-app*/"
"start_url":"h5.m.taobao.com/trip/sub-app*/"
Pretty neat right?
And It seems accommodate most use cases related to path well ;)
Will deal this, if it's an actual bug, as part of the work we will do to close off any remaining scope member issues.
@marcoscaceres It's mean a while since I opened this. Great to see a following work going on!
I have a simpler question to ask relating to this:
if a site has two manifests with scope / and scope
/sub-app/, when navigating to an URL, how does the user agent decides which app this URL belongs to?
Currently Chromium matches with the app that has the longest scope. So if both apps are installed, navigating to /sub-app/page in a tab will have a launch icon in the omnibox to direct user to launch sub-app.
Should this be clarified in manifest spec?
Most helpful comment
Well, let's take Alibaba as a example.
You might have heard about Alibaba's Taobao.com? The biggest e-commerce site of China.
The URL of Taobao mobile web app is
h5.m.taobao.com/;In the meantime, a separate web app named AliTrip is under
h5.m.taobao.com/trip/home/;Moreover, some sub-apps of Alitrip are under
h5.m.taobao.com/trip/whatever/;What if Taobao and Alitrip want to build their own PWA without altering the domains? And what if users want to add those sub-apps of AliTrip independently? (I mean, they are hotel booking, airplane ticketing thus It totally make sense.) That will make nested manifests happen.