5

I am creating an app using PhoneGap for Android, iPhone and Windows Phone. I have to send a common URL in phone by SMS, so is it possible to open the native app store in the phone through a common link?

Like if someone have iPhone then after clicking on that link the app store will show that app to download.

Phonolog
  • 6,321
  • 3
  • 36
  • 64
Tusshar Kumar
  • 51
  • 1
  • 2

1 Answers1

4

You could detect which OS the client is using and then proceed to load the correspondent URL. As Govind Singh Nagarkoti suggests in this post ( redirect to appstore or google play ) you could do something like this:

<script>
     $(document).ready(function (){
         if(navigator.userAgent.toLowerCase().indexOf("android") > -1){
             window.location.href = 'http://play.google.com/store/apps/details?id=PACKAGEURL';
     }
         if(navigator.userAgent.toLowerCase().indexOf("iphone") > -1){
             window.location.href = 'http://itunes.apple.com/lb/app/PACKAGEURL';
     }
    });
</script>
Community
  • 1
  • 1
PayToPwn
  • 1,238
  • 1
  • 16
  • 29