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 ins开发者_如何学Pythontead 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?
window.launchsockPicker = function() {
setTimeout(function() {
window.location = 'http://myDomain.com/install-app.cfm'
}, 500);
window.location = 'myApp://?context=someVariableIfNeeded';
};
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.
精彩评论