Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a link that either launches iOS app, or redirects to app store [duplicate]

Possible Duplicate:
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?

I have a custom URL scheme for my iOS app, and I want to be able to email a link to someone that will either launch the app if it's on the device, or take them to the app store if they don't have it.

I'd like to be able to send myapp://someurl and have that either launch or go to myapp on the appstore, but I don't think this will work out of the box.

Instead, I'm thinking of creating a link that loads some javascript which will try myapp://someurl, and if that fails will instead load the app store link.

My javascript knowledge is crappy. I can set window.location to perform the redirect, but there doesn't seem to be a way to catch errors from that in order to perform another action if that fails.

Anyone know how to do this?

like image 417
Silromen Avatar asked Jan 12 '11 17:01

Silromen


2 Answers

 window.launchsockPicker = function() {
       setTimeout(function() {
        window.location = 'http://myDomain.com/install-app.cfm'
       }, 500);

       window.location = 'myApp://?context=someVariableIfNeeded';
   };
like image 151
David Vaccaro Avatar answered Oct 18 '22 14:10

David Vaccaro


There is no good way to achieve this. You can launch an app via a URL but there is no way to test whether an app is installed first.

like image 23
TomSwift Avatar answered Oct 18 '22 13:10

TomSwift