-
Notifications
You must be signed in to change notification settings - Fork 162
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
Way to detect if a web app is installed #1092
Comments
Previously #273 |
This is the first I'm hearing of Q: Is there a difference between I would prefer to have some way to express that as a CSS MQ. I seem to be able to express it using
I don't follow this (also, which spec?). If you use |
Note from chatting with Marcos: Yes it basically is dm: fullscreen is true when you're in the browser but fullscreen mode. But Further discussion: Ideally such a thing would be itself a new MQ, not a JavaScript Boolean with somewhat the wrong name. So we can design a new MQ for it. But that aside, should we just standardize Matt will ask around internally to see if we have seen compat issues due to a lack of |
Having a corresponding media feature/query would be great, particularly given the use case is generally to control the web page's UI (generally to take away install buttons and instructions). It could be as simple as ( |
FWIW, it's been something iOS-focused web developers have depended upon and expected to be in Chrome DevTools' iOS device simulation mode, so I filed crbug/1197498 some time ago. I'm not opposed to standardizing it as a legacy feature. The future is definitely non-ambiguous media queries where you can exactly express what you want to test for, which is why I created the WebKit bug. If WebKit decides to report it, there should probably a differentiation between navigation controls on (corresponds to |
Update here. Standardizing What happened?Mozilla to detect the iPad Pro was using So Safari 17 Desktop with Mozilla fixed it. So this is to keep in mind in the solutions that needs to be evaluated. |
One potential difference here, if you want an "is this installed" bit, is that display mode css media query is spec'd to be the current display mode, which includes 'fullscreen'. So if you have an installed app that you go fullscreen, then it'll be "standalone" -> "fullscreen" -> "standalone" (when you exit fullscreen). This seems to really confuse developers, so I propose we have a signal that is something like "is this URL within scope of an installed app" signal (this allows it to work with Safari & Chrome's different implementations of isolation). |
@dmurph, that's an interesting re-interpretation and might work. However, when you say "This seems to really confuse developers", what is "this" exactly? Can you clarify a bit? |
Reminder: there's a lengthy discussion of an “installed” signal on the App Info spec: w3c/manifest-app-info#42 There is also the Client Hint for display modes proposal too (though that's more server side). Of course I'm also still super skeptical about the wisdom in relying on display modes as an indication of installation. I'd much prefer an explicit signal that you are, in fact, viewing the site in it's installed state (hence the discussion above). I'm not entirely sure what's to be gained from having this. I'm not deadset against it, I guess I'm just not convinced of the value yet. |
Discussing with @dmurph, as an alternative:
And we keep the legacy:
As WebKit/Safari Web Apps are fully isolated (they are an entirely different user agent), there is no way of sharing "is this web app installed". For a site in a browser to know if a web app is (or was) installed would break the privacy model of Safari. |
I can understand how, when compared to the web overall, this would be an issue, but this is not something shared by apps developed in Swift, even those that make use of the web view, right? I'm also curious to know what Apple's specific privacy concerns are, especially if the check only applied specifically within the context of the installed app and not in a casual browsing (e.g., browser tab) scenario. |
Action here is to float this with the CSS Working Group. You say "installed" in cases where you wouldn't want to show an install button... has the user "installed" this web application. Only applies to top-level navigable. This can't apply cross origin. Cross-origin must return false (or "no"). |
Feedback here: https://issues.chromium.org/issues/331692948#comment15
This is supportive evidence for an 'installed' attribute that can be media-queried. |
Also interested in thoughts from folks on this doc: https://bit.ly/pwa-detecting-install |
It's impossible to know if our app is running as a PWA when using Chrome Enterprise Kiosk & Signage, which is really impactful because Chrome Enterprise Kiosk doesn't allow users to open external links at all. We need to handle this, but there's no way to detect if our app is running as a PWA in Chrome Enterprise Kiosk. |
Hey @tomayac or @reillyeon, can you please see #1092 (comment) ... it's a bit out of scope for this repo, but maybe a quick response to the above? |
This looks more like a Chrome feature request than something we'd want to discuss in the manifest spec repository. Could you open a new Chrome bug for this, please? |
@tomayac Chrome team sent us here |
I'm not sure what Chrome Enterprise does exactly in kiosk mode. The usual flow would be to chck |
@tomayac Chrome Enterprise behaves exactly like regular Chrome, except Chrome Enterprise cannot open external links in kiosk mode. In both cases, it is impossible to determine if an app is running as a PWA when fullscreen is enabled (which is always the case "fullscreen" in Chrome Enterprise Kiosk). When Chrome Enterprise Kiosk runs a PWA, a regular browser page in fullscreen mode, or a PWA on Chrome, all return check this comment: https://issues.chromium.org/issues/331692948#comment4 |
I believe, from TPAC, we are in agreement on: where (although, to bikeshed, should we do |
Discussed with @dmurph, let's stick to "installed". |
AI Generated based on what we discussed: Explainer: Standardizing and Implementing Web Application Context DetectionOverviewThis feature standardizes the terminology and mechanism to detect whether a web application is operating in an "installed-like" context (e.g., launched as a standalone app, added to a home screen). The goal is to replace the ambiguous term "installed" with a clear and developer-friendly alternative while aligning browser implementations and specifications. Problem StatementWeb applications often operate in different contexts, such as:
Currently, developers rely on terms like "installed," which are inconsistently defined across platforms. This ambiguity leads to challenges in building cohesive user experiences. Proposed SolutionStandardize the terminology and introduce clear mechanisms to detect and respond to a web app's context. The proposed term (e.g., "Standalone Mode", "PWA Mode") will be applied consistently in the Web App Manifest specification, browser implementations, and developer tools. Feature Goals
How It WorksTerminologyWe propose replacing "installed" with:
Media Query ExampleThe @media (display-mode: standalone) {
body {
background: #f0f0f0;
}
} API ExampleA new property or method can provide a programmatic way to check the app's context: if (navigator.standalone) {
console.log('The app is running in Standalone Mode!');
} User ExperienceFor end-users, this change is seamless. Developers gain better tools to optimize user experiences across contexts. Implementation PhasesPhase 1: Specification Updates
Phase 2: Implementation in WebKit
Phase 3: Alignment with Chromium
Phase 4: Developer Outreach
Benefits
Next Steps
By standardizing this terminology and implementation, we can make the web platform more robust, predictable, and developer-friendly. |
another version from AI that likely has weird problems: Detecting Installed Web Apps: A New CSS Media Query and PropertyDevelopers have long requested a reliable way to detect if a web app is installed on a user's device. This is important for tailoring the user experience, such as hiding install prompts or providing app-specific features. A new CSS media query and JavaScript property are being introduced to address this need and overcome limitations with existing methods. The New Features:
Use Cases:This feature addresses several crucial use cases:
Benefits:
Next Steps:The proposal is currently being discussed within the W3C Web Apps Working Group and will be implemented in major browsers like WebKit and Chromium. This collaboration aims to create a consistent and reliable way for developers to detect and respond to the context of their web applications. |
The
navigator.standalone
attribute has been in iOS since forever and has the nice semantics in that, as a boolean value, it distinguishes between installed web applications and those running in the regular browser tab.It's slightly unfortunate that "standalone" will mean "installed" (as per the spec's definition), and there is also "display-mode: standalone", but I think that's ok.
What do folks here think? @dmurph, @aarongustafson, would love to hear your thoughts!
See also this webkit bug.
The text was updated successfully, but these errors were encountered: