Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

143
Vistas
How to redirect an URL and open in-app (Android & iOS)

I want to redirect an URL with PHP or JavaScript. If the app is installed, It will be opened in-app (like in Instagram, YouTube app). If not, it will be opened in the browser. https://app.urlgeni.us/ can do this and I want to create a system like that. How can I do that too?

My codes are like that but they don't work.

PHP:

<?php header("Location: instagram://user?username={USERNAME}"); ?>

JavaScript:

var destination = "instagram://user?username={USERNAME}"; 
if( navigator.userAgent.match(/Android/i) ) {
  // use Android's redirect
  document.location = destination;   
}   
else {
  // use iOS redirect
  window.location.replace( destination );
}

setTimeout(function(){
   window.location.replace("https://www.instagram.com/{USERNAME}/");
}, 1000);

Source: How to make redirect to instagram://user?username={username}

Additional: When I create a link like this and click it manually, it works. But when I redirect to this link, it doesn't work.

<a href="instagram://user?username={USERNAME}">Open in Instagram app</a>

This doesn't work either:

<a id="link" href="instagram://user?username={USERNAME}">Open in Instagram app</a>
<script type="text/javascript">
   var link = document.getElementById("link");
   link.click();
</script>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda