最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Popup for android or iphone tot download app when visiting site - Stack Overflow

programmeradmin1浏览0评论

) We have in app for android and iphone. When someone visits are website using their mobile phone, we want i popup that says.. Hi we have an app, want to download it? or whatever ;-) When selected yes, it has to download the app.

But i only want the popup to display when the app is not yet installed... So far i found this code.. As you can see, this wont work.. If anyone could help me out! Would be great!

<script type="text/javascript">
  if( /Android|iPhone|BlackBerry/i.test(navigator.userAgent) ) {
  var url=confirm("Would you like to download our mobile application?");
    if (url==true)
  {
    var url = window.location.href = '?    id=.appmachine.p9890BH';
url.show(); 
  }
    else
  {

  }
    }
  </script>

) We have in app for android and iphone. When someone visits are website using their mobile phone, we want i popup that says.. Hi we have an app, want to download it? or whatever ;-) When selected yes, it has to download the app.

But i only want the popup to display when the app is not yet installed... So far i found this code.. As you can see, this wont work.. If anyone could help me out! Would be great!

<script type="text/javascript">
  if( /Android|iPhone|BlackBerry/i.test(navigator.userAgent) ) {
  var url=confirm("Would you like to download our mobile application?");
    if (url==true)
  {
    var url = window.location.href = 'https://play.google./store/apps/details?    id=.appmachine.p9890BH';
url.show(); 
  }
    else
  {

  }
    }
  </script>
Share Improve this question asked Jan 3, 2014 at 15:28 GiancarloGiancarlo 311 silver badge3 bronze badges 2
  • You want a web page to be able to read what apps a user has installed? Really? Do you think this might be a security/privacy problem? I don't know iOS, but on Android, this is not possible. – Simon Commented Jan 3, 2014 at 15:36
  • Hi Simon, thanks for that insight. If that is a problem, we need the code without that bit. So only if android, it should show download popup for play store, and for iphone a dwonload for itunes. – Giancarlo Commented Jan 3, 2014 at 15:43
Add a ment  | 

1 Answer 1

Reset to default 4

For the iPhone, promoting your app while checking for its existence is possible with Apple's smart app banner, here are the docs.

This is limited to Apple and Safari, but it's a good starting spot.

Otherwise, I used this library and it has worked pretty well out of the box for me so far..

发布评论

评论列表(0)

  1. 暂无评论