简体   繁体   中英

Is there any way to detect if a user has added a web app to their home screen?

I'm using an iOS springboard "Add to home screen" notification on a site, which appears depending on certain user information. I just don't want my popup to trigger if the user has already added the web app to their home screen.

Is there any way to detect this?

You should be able to see if fullscreen or in a browser using

if (navigator.standalone) {
    alert ('Running full screen');
} else {
    alert ('Running in a browser');
}

Or an alternative approach would be to look at the window size, to see if there are any chrome around.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM