title: Deeplinking mobile browsers to native app - Issues with Chrome when app isn't installed
body: <p>I have a webpage, lets call it <code>entry.html</code>.</p>
  
  <p>When a user enters this page, a javascript code (see below) is attempting to deep-link the user to the native iOS / Android app.</p>
  
  <p>If the deep-link fails (probably if the app isn't installed on device), user should "fall back" to another page- lets call it <code>fallback.html</code>.</p>
  
  <p>here is the javascript code that is running on <code>entry.html</code>:</p>
  
  <pre><code>$(function(){
      window.location = 'myapp://';
      setTimeout(function(){
          window.location = 'fallback.html';
      }, 500);
  });
  </code></pre>
  
  <p>this is a standard deep-linking method that is recommended all over the network; try to deep-link, and if the timeout fires it means that deep-link didn't occur- so fallback.</p>
  
  <p><strong>this works fine, as long app is installed on device.</strong></p>
  
  <p>but if the app isn't installed, this is the behaviour when trying to deep-link:</p>
  
  <p><strong>Mobile Safari</strong>: I see an alert message saying "Safari cannot open this page..." for a moment, and then it falls-back properly to <code>fallback.html</code>- which is the expected behaviour.</p>
  
  <p><strong>Mobile Chrome</strong> is my problem.</p>
  
  <p>when the app isn't installed, browser is actually redirected to the <code>myapp://</code> url, which is of course, invalid- so i get a "not found" page, and fall-back doesn't occur.</p>
  
  <p><strong>Finally</strong>- my question is:</p>
  
  <p>How can I fix my code so FALL-BACK WILL OCCUR on mobile Chrome as well? just like mobile Safari?</p>
  
  <p><em>note: i see that LinkedIn mobile website does this properly, with Safari &amp; Chrome, with or without the app installed, but i couldn't trace the code responsible for it :(</em></p>
  
  <p><em>note2: i tried appending an <code>iframe</code> instead of <code>window.location = url</code>, this works only on Safari, mobile Chrome doesn't deep-link when appending an iFrame even if app is installed.</em></p>
  
  <p>Thanks all!</p>
  
  <hr>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>i found a decent solution, and answered my own question. see accepted answer for my solution.</p>