Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically redirecting users to a deep link in chrome is not working

I am trying to do deep linking such that when a user opens a webpage it automatically opens the app

<!DOCTYPE html>
 <html>
  <body>
    <a href="myapp://data/">Open App</a>
    <script>
     window.location = 'myapp://data/';
  
     link = document.querySelector('a')
     link.click();
    </script>
  </body>
 </html>

Currently when the user clicks the link, everything works but nothing works if i try to automatically trigger the deep link, neither using window.location for redirect or triggering a click event on the link seems to be working.

I need a way to automatically redirect to the deep link and not wait for the user to click on the "Open App" link

like image 610
Jonathan Utsu Undelikwo Avatar asked Oct 18 '25 06:10

Jonathan Utsu Undelikwo


1 Answers

Deep linking will not work if the event is not user-driven. By default, Chrome is the browser that handles deep linking in Android.

And Chrome doesn't launch an external app for a given Intent URI in the following cases.

  • When the Intent URI is redirected from a typed in URL.
  • When the Intent URI is initiated without user gesture.

See: https://developer.chrome.com/docs/multidevice/android/intents/

like image 111
Dan H Avatar answered Oct 19 '25 23:10

Dan H



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!