-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
openWindow with a WebApp manifests #720
Comments
It seems to me the UA should persist the "saved-to-homescreen" and "display=standalone" bit when the SW is registered. It can then use this information to do the right thing for openWindow(). Of course, this begs the question what should be done if the same site is opened as an installed app and in a normal browser window. Do you end up with two registrations? Are they effectively treated as separate origins? Thats what we do on firefox os, but its unclear to me if thats correct or desirable. |
FWIW we're moving away from this behaviour. I think this maybe relates to deep linking [1] and scope [2]. My interpretation is that when a web app is installed, it should be registered as handling a URL scope specified by the scope property, then any navigation from an existing window or the creation of a new window at a URL within that navigation scope should have the metadata from the manifest applied. In other words, creating a new window within the navigation scope of an installed app should make the browsing context of that window an application context. This is why I think manifest scope is important as well as Service Worker scope. This is purely theoretical at this point as to my knowledge nobody has implemented this yet. On Android I can see this potentially mapping onto App Links [3], but I'm not sure whether Google has any intention of implementing this part of the spec in Chrome? |
Glad to hear we're moving away from installed pages being different effective origins from when they are viewed in the page. In regards to using scope, though, I think a fair number of people are concerned about them. Recently it was described to me that historically we've had origins and URLs as primitives on the web. The scope is effectively a new primitive that relates a collection of URLs. It seems some people are legitimately worried that the scope primitive has not been fully thought out. Having it introduced in service workers and ripple out to other specs may not be the best way to change the architecture of the web platform. |
I think there's opportunity here for some kind of "launch" event in the SW, where it can decide if a new client should be opened, or whether an existing client should be used for the navigation, or maybe a navigation shouldn't happen at all. This would allow you to create multi-window apps (eg docs) or single window apps. We should discuss this at the f2f. |
We've discussed this in a few other issues, particularly regarding giving sites control about how to handle navigation disposition (e.g. #758). Moving to V2. |
I gave a presentation in several meet ups about PWA these days and this was a recurrent question:
One of the approaches would be to rely on The other is to allow |
@delapuente: I just wanted to follow up on the notifications-not-opening-home-screen-web-app issue. I implemented this feature in Chrome (it landed in Chrome 51), and if it's not working for you I'd love to understand why (and try and fix it). We currently use a heuristic that the link in the notification to be opened needs to share the longest path of the homescreen shortcut's URL. This is obviously a bit deficient, but working out how to do this properly with scopes and the like is complex. Is the notification opening a link that lives on a different origin/path to the app you added to your homescreen? |
It seems to me this should be a spec'd thing and not just a browser heuristic. Maybe we could formalize this behavior in the spec for now. In the future we could add some kind of entry to the manifest or a meta tag to match other URLS. |
@wanderview agreed! I'm still quite new to the spec-related side of browser work, so I've been pretty deficient in this area. I think the original intention of the scope manifest entry was to handle this sort of functionality, but the way it interacts with the service worker scope and potential conflicts with other installed web apps is tricky to detangle. |
This issue is happening to my PWA. Here is another common scenario similar to the case of push notifications:
One possible solution is for openWindow to use the window styles/size/position of the window that installed the serviceWorker (all of which chrome currently does when launching in homescreen mode). The issue goes together with using notification requireInteraction (supported in Chrome and planned for mozilla52.) When using that flag, the notification stays up even when closing the browser, increasing chances of hitting this. |
I believe this has been fixed in Chrome. If not, please file at crbug.com with recreation steps. |
When using a web application manifest together with a service worker, this can happen:
The user opens a web application and installs it as application (using the manifest), for example in Chrome for Android's "Add to Homescreen".
The user uses the app as if it were a native application, for example when using "display"="standalone" in the application manifest.
The application gets a push notification. When clicking the notification, this code is executed (from MDN:
If only the web application is open, that is opened. If there is no client, a new tab/window will be opened in the browser, not the application saved to the homescreen as expected.
Maybe this is an implementation issue, but I think there should be a way for a service worker to specify how the window should be opened, or it should always be opened as an app if it is installed.
(Note: I never commented on a spec before, so keep that in mind if this issue should be directed elsewhere).
The text was updated successfully, but these errors were encountered: