Skip to content
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

Feature detect request: Web App Manifest (PWA Support) #2305

Open
benseven opened this issue Apr 10, 2018 · 3 comments
Open

Feature detect request: Web App Manifest (PWA Support) #2305

benseven opened this issue Apr 10, 2018 · 3 comments

Comments

@benseven
Copy link

Looking to be able to combine feature detection for service workers — already in Modernizr — with a test for whether the browser supports / cares about the Web App Manifest, so as to progressively disclose the existence of PWA features to the user.

Example: A user on the 'my account' page of a membership portal who is on iOS 11.3 or later sees a promotion block about our new virtual membership card added to their home screen as a standalone PWA, but a user on iOS 11.2 or earlier - which does not support basic PWA features - does not see the promotion block for something their browser doesn't support.

Thanks!

@roblarsen
Copy link
Contributor

Looking at the spec, would:

Modernizr.addTest("webappmanifest","BeforeInstallPromptEvent" in window)

work?

If so, that's like 50% of an easy PR for someone right there.

@benseven
Copy link
Author

benseven commented Apr 11, 2018

Thanks for the help!

I've started a Codepen tracking my aims and tests - unfortunately as you'll see from the results there, testing this pen based on your suggestion resulted in a false negative from Safari on iOS 11.3 - according to this tweet from a Safari engineer, Web App Manifest is supported there.

I'm assuming this is because while Safari on iOS 11.3 will consult the web app manifest, it doesn't support BeforeInstallPromptEvent.

Potentially, I could combine that first test (BeforeInstallPromptEvent) with a check for Service Worker support (already in Modernizr) and some kind of horrible test specifically for Safari on iOS 11.3 and later, but if you have any nicer ideas I'd love to hear them.

@NOtherDev
Copy link

NOtherDev commented Apr 11, 2018

It is problematic to use BeforeInstallPromptEvent as the only check. Lack of existence of such does not indicate the lack of "add to home screen" support nor lack of Web Manifest support.

Technically, to detect just the manifest support in any form (including the most basic ones), one should check if <link> tag supports the rel="manifest" value.

See the whole discussion here: NOtherDev/whatwebcando#36.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants