2

I've already been able to setup deep links (universal links), whenever a link to my site (https://app.example.com) is clicked, it automatically opens the app. If its from slack, messenger or another website. The problem is, if I'm inside app.example.com and I create a link to open app.example.com, it doesn't open the app.

I cant seem to find any documentation to address this problem and I'm not sure if its even allowed, but basically this is the flow that I want to achieve:

  1. (inside app) Click Connect Wearable button
  2. (in browser) Default browser opens wearable's login page
  3. (in browser) Wearable redirects to my own site (https://app.example.com/confirmed)
  4. (in browser) Inside this page is a button that says Return to App [href="https://app.example.com/"]
  5. (inside app) App opens

But as mentioned, step 5 doesn't open the app even if I placed a link-button (as expected on how universal links work), it just redirects within the browser.

Any solution? I need to be able to handle android and iOS, as well as not interfere with PC browsers. If needed, I code using Ionic v6.

Thank you!

Jordin Vell
  • 141
  • 1
  • 2
  • 11
  • Are you using any plugin for deeplink ? – Swayangjit Jun 02 '22 at 06:29
  • @Swayangjit no, i followed this guide https://devdactic.com/setup-deep-links-capacitor/ – Jordin Vell Jun 02 '22 at 07:13
  • Does this answer your question? [Deep link won't work if opened from the same domain](https://stackoverflow.com/questions/47117683/deep-link-wont-work-if-opened-from-the-same-domain) – selcuk-sahin Jun 03 '22 at 09:33
  • @JordinVell Not sure if this will work in your case but I had a similar req wanting 'when in app click on deep-link of same app' and it worked with the below. Req: - app is open and being used by user, button is clicked from within the app which holds an app deep-link. navigate user according to deep-link url. Achieved by below code. Note: It only worked when setting the "target" to *_system*. window.open(${enter https deep-link here}, '_system'); – Kirsten Sep 22 '22 at 01:57

2 Answers2

1

As far as I know, this is expected behavior.

The reason is,

Let's say your user actually chose to navigate to your website instead of the application. Since the user is already browsing the website, we can assume the user will keep browsing the website, otherwise, he or she would be inside the app already.

This user might navigate to different pages on your website. If deep links try to send users to the app every time, it would be a terrible UX.

If your intent is to always open the app anyways, using a custom URI scheme is the way to go.

selcuk-sahin
  • 327
  • 2
  • 10
-1

You can try defining custom URI scheme for your apps like "myApp://" and use that inside the button in browser.