Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!