title: iOS: opening app with custom URL if installed, itunes otherwise
body: <p>I implemented a <a href="https://github.com/asianmack/play-store-smartbanner" rel="nofollow">smart app banner</a> for my website in order to redirect user to our Android or iOS app. By parsing the user agent I could successfully redirect to Android app or Google Play Store (using an intent filter): now I'd like to do the same for iOS, opening the app if it's installed and opening iTunes elsewhere.</p>
  
  <p>I managed to open the app, if it's installed, by using a Custom URL Scheme</p>
  
  <pre><code>&lt;a href="myurlscheme://main"&gt;
  </code></pre>
  
  <p>Now I'd like to make iTunes start if the app is not installed on device. How can I achieve that?</p>
  
  <p>Thank you</p>