Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

344
Visualizações
Is it possible to open a URL in a client default mobile browser while the click originated from an in app browser?

The answer might be a resounding no, but I figured I'd ask anyway. I realize this might be a security nightmare.

I created the following test page that checks whether or not the user is using an in app browser or not and displays a link accordingly.

When the user does use an in app browser, I am displaying the "continue here" link and I would like him to be prompted to choose to open the link in his mobile's default browser rather than in the in app browser he is currently using.

<html>
<body>
<a id="btn" href="#" onclick="window.open('https://www.google.com', '_system'); return false;">Continue here</a>
<a id="btn2">not in app browser</a>
</body>
</html>



<script>
    webviewCheck();
    function webviewCheck() {
        let standalone = window.navigator.standalone,
            userAgent = window.navigator.userAgent.toLowerCase(),
            safari = /safari/.test(userAgent),
            ios = /iphone|ipod|ipad/.test(userAgent);

        if (ios) {
            if (!standalone && safari) {
                // Safari
                console.log("safari browser is being used");
                document.getElementById("btn").hidden=true;
            } else if (!standalone && !safari) {
                // iOS webview
                console.log("IOS webview is being used");
                document.getElementById("btn2").hidden=true;
            };
        } else {
            if (userAgent.includes('wv')) {
                // Android webview
                console.log("Android webview is being used");
                document.getElementById("btn2").hidden=true;
            } else {
                // Chrome
                console.log("Other browser is being used (firefox/chrome/edge/etc)");
                document.getElementById("btn").hidden=true;
            }
        };
    }
</script>


about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

maybe this can be helpful Can I make a link that will open in my app if it's installed, and fall back to a different URL if not?

function openLink () {
    var appWindow = window.open("ourapp://www.ourdomain.com/files/12345","_blank");
    setTimeout( function () {if (appWindow) {
        appWindow.location ="http://www.ourdomain.com/buyourapp";
            }
            },1000);
}
about 4 years ago · Juan Pablo Isaza Relatório

0

This should force system browser on Android/iOS:

window.open(url, '_system');

But this will also continue using system browser when executed on system browser so not sure why you want to distinguish those cases.

about 4 years ago · Juan Pablo Isaza Relatório

0

Yes, it's very much possible if the user is logged in. You will have to make a database column of maybe boolean field.

can_open_url = False

Whenever the user performed the action, you will allow it to touch your database and update your filed,

can_open_url = True

With the help of ajax or fetch, you can trigger the function in your (backend code) upon user's gesture in the browser, and ask if the the field is True, something like this:

    if(can_open_url === true){
        window.location.href = '/my_url/'; or
        if(window.location.href != "/my_url/"){
            window.location.replace("/my_url");
}

or you can still open a new window as you did. Then re-update the boolean field to its formal value after a successful manipulation.

The main transaction will take place on your backend, because you will have to know all the browsers where the user is logged in and with that you can query the one where the URL will be opened for the user.

I don't know the backend you are using. If you specify your backend i may still give you more hand on a way to do it, only if you feel the answer may be helpful.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda