title: Create Deep Link for Mobile App
body: <p>I want to create a promotional link for my app - which i can distribute via email. When the user clicks on the link from the email, a webpage does this:</p>
  
  <ol>
  <li>Determines which OS (iOS or Android)</li>
  <li>If app installed on device - opens the app</li>
  <li>Else - takes user to AppStore (or) PlayStore (or) a custom URL.</li>
  </ol>
  
  <p>I tried using the AppLinks (applinks.org) - but I am unable to get it to work. How does the browser understand the "al:xx:xxx.." tags ? Does it only work for facebook/twitter? </p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
         &lt;meta property="al:ios:url" content="applinks://docs" /&gt;
         &lt;meta property="al:ios:app_store_id" content="12345" /&gt;
         &lt;meta property="al:ios:app_name" content="App Links" /&gt;
         &lt;meta property="al:android:url" content="applinks://docs" /&gt;
         &lt;meta property="al:android:app_name" content="App Links" /&gt;
         &lt;meta property="al:android:package" content="org.applinks" /&gt;
         &lt;meta property="al:web:url" content="http://applinks.org/documentation" /&gt;
     &lt;/head&gt;
  </code></pre>
  
  <p></p>
  
  <p>I also tried some javascript from another post - but if the app is not installed the browser shows an error:</p>
  
  <pre><code>&lt;script&gt;
      window.onload = function() {
          window.location = 'http://www.launchMyApp';
  
          setTimeout("window.location = 'http://play.google.com/someApp';", 1000);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Please help with this.
  Thanks.</p>