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

2

11

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?

Variegation answered 12/1, 2011 at 17:4 Comment(1)
There is a really good answer here: #1109193Zora
R
7
 window.launchsockPicker = function() {
       setTimeout(function() {
        window.location = 'http://myDomain.com/install-app.cfm'
       }, 500);

       window.location = 'myApp://?context=someVariableIfNeeded';
   };
River answered 26/12, 2012 at 22:44 Comment(3)
Could you explain why this answers the question?Dunkle
This bit of code will actually check if app is installed and launch it if so, otherwise will redirect to the app store.River
Your install-app.cfm or HTML will launch the page, see if the app exists and launch or redirect to the app store.River
O
2

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.

Overstride answered 12/1, 2011 at 17:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.