Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48983

Has anyone with a PWA successfully prompted iOS user to 'Add to homescreen'

$
0
0

Has any built a PWA and successfully added a prompt on iOS to ‘Add to Homescreen’? It works on Android but not iOS. If been reading mixed responses. Some people are saying that there’s no way to add this feature to iOS because Apple doesn’t want to allow developers to avoid their app store.

This is the only code that I’ve found that will allegedly work but it doesn’t stipulate where this code should be added within the app.

// Detects if device is on iOS
const isIos = () => {
const userAgent = window.navigator.userAgent.toLowerCase();
return /iphone|ipad|ipod/.test( userAgent );
}
// Detects if device is in standalone mode
const isInStandaloneMode = () => (‘standalone’ in window.navigator) && (window.navigator.standalone);

// Checks if should display install popup notification:
if (isIos() && !isInStandaloneMode()) {
this.setState({ showInstallMessage: true });
}
Has anyone implemented a PWA that prompts the ‘Add to homescreen’ in iOS?

Will push notification work if they do that?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>