Search code examples
javascripthtml

Force Open External Browsers instead of any in-app browser [HTML/Javascript]


I've already researched and found a lot on this topic, but there's an idea that I still couldn't find and wanted to see if it's possible.

A bit of a background, I'm not a back-end developer and I'm not as well versed in it. But I have written a small website using HTML, CSS & Javascript (jQuery).

In-app browser is a problem for me since I am using localStorage to store some information for the user, and being its in-app then the user will lose all those details once they leave instagram, for example.

I've come upon a few results, and some here on stackoverflow, but some answers did not work (link 1, link 2) and most answers said that this is not possible anyway.

So I was wondering (and I'd take this as a learning experience) about the following use case:

Let's take Instagram as the example here. If we set in our bio the link to youtube let's say, the youtube website will display at the top "Open in App" button, which in that way can then open the native youtube app and the user can continue normally. In that sense, isn't it possible to let's say, to create a button like "Open in Safari", and once the user opens my website they will be able to tap it and it would open the safari app with its appropriate link? Or is this not possible also since it should be coded from Safari's end?


Solution

  • A URL Scheme is what you need. for example:

    Google Chrome: googlechrome://domain

    Safari: safari-https://domain

    Firefox: firefox://open-url?url=domain

    Opera: opera-https://domain

    X Web: x-web-search://search+term