title: How to stay in iOS Safari's standalone mode when navigating
body: <p>When in iOS' standalone web app modus, and you click a link, that link is opened in Mobile Safari instead of staying in the standalone modus. This makes no sense to me (at least for internal links).</p>
  
  <p>The only way I can think of fixing this is adding a click handler to the <code>document</code> node, and manually navigating like this:</p>
  
  <pre><code>if (window.navigator.standalone) {
    document.addEventListener('click', (e) =&gt; {
      if (e.target.tagName === 'A') {
        e.preventDefault();
        window.location = e.target.getAttribute('href');
    });
  }
  </code></pre>
  
  <p>Is there a less hacky way of obtaining this behavior? This really hurt my eyes.</p>