简体   繁体   English

来自同一网站的深层链接不起作用

[英]Deep links doesnt work when coming from the same website

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.我已经能够设置深层链接(通用链接),只要点击指向我网站的链接( https://app.example.com ),它就会自动打开应用程序。 If its from slack, messenger or another website.如果它来自 slack、Messenger 或其他网站。 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.问题是,如果我在 app.example.com 中并创建了一个链接来打开 app.example.com,它不会打开该应用程序。

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 ) (在浏览器中)可穿戴设备重定向到我自己的网站( https://app.example.com/confirmed
  4. (in browser) Inside this page is a button that says Return to App [href="https://app.example.com/"] (在浏览器中)此页面内有一个按钮,上面写着 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.但如前所述,即使我放置了一个链接按钮(正如预期的通用链接的工作方式),第 5 步也不会打开应用程序,它只是在浏览器内重定向。

Any solution?任何解决方案? I need to be able to handle android and iOS, as well as not interfere with PC browsers.我需要能够处理 android 和 iOS,并且不干扰 PC 浏览器。 If needed, I code using Ionic v6.如果需要,我使用 Ionic v6 进行编码。

Thank you!谢谢!

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.如果您的意图是始终打开应用程序,则使用自定义 URI 方案是通往 go 的方法。

You can try defining custom URI scheme for your apps like "myApp://" and use that inside the button in browser.您可以尝试为您的应用程序定义自定义 URI 方案,例如“myApp://”,并在浏览器的按钮内使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM