简体   繁体   English

如何防止ios通用链接在用户点击子域A页面中的url时打开APP,并且该url链接到子域B

[英]how to prevent ios universal link open the APP when user click a url in subdomain A page, and the url is linking to subdomain B

We added associated domains in our ios APP, like this:我们在我们的 ios APP 中添加了关联域,如下所示:

<string>webcredentials:*.mywebsite.com</string>
<string>applinks:*.mywebsite.com</string>

We also uploaded apple-app-site-association file for all our subdomains.我们还为我们所有的子域上传了 apple-app-site-association 文件。 Like below:像下面这样:

{
   "applinks": {
      "apps": [],
      "details": [
         {
            "appID": "XXXXX.com.mywebsite.www",
            "paths": [
               "NOT /whatever",
               "some other paths here",
               "/"
            ]
         }
      ]
   },
   "webcredentials": {
      "apps": [
         "XXXXX.com.mywebsite.www"
      ]
   }
}

It works fine if user click a url on google page which links to www.mywebsite.com , it will open the APP.如果用户单击链接到www.mywebsite.com 的google 页面上的 url,它会正常工作,它将打开 APP。

But my problem is, if we have a subdomainA.mywebsite.com/test.html, like this:但我的问题是,如果我们有一个 subdomainA.mywebsite.com/test.html,就像这样:

<a href="https://www.mywebsite.com/">HOME</a>

If user click the link, it will also open the APP, this is NOT what i want.如果用户点击链接,它也会打开应用程序,这不是我想要的。

So my question is, how can i disable universal link opening the APP if on subdomainA user clicks a url that links to subdomainB, and the url's path is registered in app site association file.所以我的问题是,如果用户在 subdomainA 上单击链接到 subdomainB 的 url,并且该 url 的路径已在应用站点关联文件中注册,我该如何禁用打开 APP 的通用链接。 Can ios know they are just subdomains so don't open the APP? ios可以知道它们只是子域所以不要打开APP吗?

You can disable Universal links by blacklisting the paths in your AASA file.您可以通过将 AASA 文件中的路径列入黑名单来禁用通用链接。 Adding NOT before the path in your AASA file won't trigger app open for your url.在 AASA 文件中的路径之前添加NOT不会触发为您的 url 打开应用程序。

{
"applinks": {
    "apps": [ ],
    "details": [
        {
            "appID": "XXXXX.com.mywebsite.www",
            "paths": [ "http://www.mywebsite.com/", "NOT http://www.subdomainA.mywebsite.com/test.html"]
        }
    ]
  }
}

Here is the apple documentation for the same: Universal Links这是相同的苹果文档: Universal Links

We ended up asking Apple for help.我们最终向 Apple 寻求帮助。 As I expected, we cannot tell Apple/IOS not to launch APP between two subdomains with same universal links.正如我所料,我们不能告诉 Apple/IOS 不要在具有相同通用链接的两个子域之间启动 APP。 The only way we can do is, if in subdomain B there is a url link to subdomain A, and this url is universal link, we have to add some special query or hash to the url, for example, url?within_subdomains=1, then in the AASA file, we add "NOT *within_subdomains=1",我们唯一能做的就是,如果在子域 B 中有一个指向子域 A 的 url 链接,并且这个 url 是通用链接,我们必须在 url 中添加一些特殊的查询或哈希,例如,url?within_subdomains=1,然后在 AASA 文件中,我们添加“NOT *within_subdomains=1”,

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

相关问题 子域后的通用链接打开URL - Universal Link open URL after subdomain 如何限制除iOS通用链接以外的所有其他路径以使用URL打开应用 - How to restrict all other paths except one for Universal link in iOS to open app using URL iOS - 如何实现深度链接以使用 URL 方案打开应用程序或转到 iTunes 链接 - iOS - How to implement Deep Linking to open App or go to itunes link using URL scheme 通用链接 iOS 9 - 带有主题标签的 URL? - Universal Linking iOS 9 - URL with a hashtag? 当用户扫描包含URL的QR码时,如何打开iOS应用程序 - How to open iOS app when user scans a QR Code with an URL in it iOS 具有二级子域的通用链接不会深度链接到本机应用程序,但在一级子域(同一主机)上的深度链接很好 - iOS Universal Link with a second level subdomain doesn't deep-link to native app, but deep-links fine on a first-level subdomain (same host) "React native Linking open url不适用于ios上的facebook链接" - React native Linking open url not working with facebook link on ios 当用户点击应用中的任何链接时,如何阻止我的ios应用打开网址? - How do i stop my ios app from opening a url when user taps on any link in the app? 如何从URL打开iOS应用程序的特定页面 - How to open a specific page of an iOS app from an URL 通用链接仅打开基本URL - Universal Link open only base URL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM