Escape instagram in app browser to safari

11,722

Not a complete answer, but could be a clue. Just put some blocking js code in the beginning of a html body.

<script>
    var str = navigator.userAgent;
    var i = str.indexOf("Instagram");
    if (i != -1) {
      document.write("<a target=\"_blank\" href=\"http://instagram.com/?nibrowser=no\">Proceed to Sfari</a>");
      window.stop();
    }
</script>

Some info about Instagram user agent: https://mpulp.mobi/2016/07/12/instagram-user-agent/

On forcing in app browsers to open Safari: https://support.interact.technology/support/solutions/articles/17000003729-how-to-force-a-link-to-open-in-safari-ios-only-

And window.stop() just prevents page load almost in all browsers. Hope it'll help.

Share:
11,722
Agu V
Author by

Agu V

Updated on June 04, 2022

Comments

  • Agu V
    Agu V almost 2 years

    I have a link in my website that redirects to instagram login to fetch some photos, but that page doesn't work on the in app browser from instagram, on an ios device. My idea is to put a link so the user can click it and be redirected to a page in safari or the default browser, is that possible?

    <a id="link" href="http://www.google.com">Google</a>