I use the following code:
if (navigator.platform == 'iPad' || navigator.platform == 'iPad Simulator' || navigator.platform == 'iPhone' || navigator.platform == 'iPhone Simulator' && window.navigator.standalone === false) {
window.alert("We've detected you're on iOS. Did you know that you can put us on your home screen? Tap the share icon, then tap 'Add to homescreen'.");
}
To alert them there is a standalone option available, however it doesn't work... strangely I only get it when the app IS in standalone mode. What am I doing wrong?
EDIT: I actually found out that I was doing code outside of a function. I thought that this would be fine, odiously not.