简体   繁体   中英

detect if user clicked on add to home screen

with javascript or jQuery, is there a way to detect if the user added my site to his home screen in mobile browsers?

i want to detect it at the second he hit on 'add to home screen'

You can try this

if(isMobile.any()) {
   alert("This is a Mobile Device");
}

And then

$("#btn-id").on('click',function(){
  //Write code to get msg
)};

Mmm this should be part of the browser's functionality and is not likely to be exposed to the js on a particular page.

So ... I think you cannot do in within the page.

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