javascript - How do I prompt iPhone/iPad visitors to install native app? -
i've visited few sites on iphone/ipad have prompted me install native app first time i've visited site. there standard script somewhere people use or should create own? must have been thousands of times before despite endless googling can't find 'stock' script can use. ideally should use cookies user doesn't prompted more once month or so.
apple have got built in way of doing relatively unobtrusively, adds "smart app banner" @ top of browser if app isn't installed:
to add smart app banner website, include following meta tag in head of each page you'd banner appear:
<meta name="apple-itunes-app" content="app-id=myappstoreid">
for more options, please see full documentation on apple's site:
this adds nice looking banner top of page, can dismissed clicking close button. unlike popup (alert box), doesn't obscure page or stall loading , goes directly app store page app when clicked. think best solution cases.
as involves adding 1 meta tag, it's easier implement other javascript based solution , there's no risk of appearing on non ios devices.
caveat: works in safari. not chrome etc.
Comments
Post a Comment