title: Opening Android app using <a> tag in html
body: <p>Using <code>&lt;a&gt;</code> tag and window.location(), how to open the android app when the link is clicked else use the browser. </p>
  
  <p>For example, i have the facebook link: fb://profile/10001901208
   and <a href="https://www.facebook.com/profile.php?id=10001901208.I" rel="nofollow noreferrer">https://www.facebook.com/profile.php?id=10001901208.I</a> tried onclick() method but it seems to work differently. </p>
  
  <pre><code>&lt;script&gt;
  window.onload = function() {
    if(navigator.userAgent.match(/iPhone|iPad|iPod/i)) {
      window.location = "&lt;TWITTER MOBILE DEEPLINK&gt;"; 
      setTimeout(function(){
          window.location = "&lt;LINK TO TWITTER ONLINE&gt;";
      }, 50);   
    } else {
      window.location = "&lt;LINK TO TWITTER ONLINE&gt;";
    }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I tried @media screen and hide and show the  tag but it didnt work as expected. Since it is predetermined, if the app is not installed it says; Page couldnt load.</p>
  
  <pre><code>&lt;a href="fb://profile/10001901208" target="_blank" class="mobile"&gt;&lt;li class="fa fa-facebook"&gt;&lt;/li&gt;&lt;/a&gt;
  
  &lt;a href="https://www.facebook.com/profile.php?id=10001901208" target="_blank" class="web"&gt;&lt;li class="fa fa-facebook"&gt;&lt;/li&gt;&lt;/a&gt;
  </code></pre>
  
  <p>I expect the output of opening the app if installed else open in the browser using window.location() and if possible with <code>&lt;a&gt;</code> tag.</p>