iosapple-app-site-association

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:

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

We also uploaded apple-app-site-association file for all our subdomains. 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.

But my problem is, if we have a subdomainA.mywebsite.com/test.html, like this:

<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. Can ios know they are just subdomains so don't open the APP?


Solution

  • We ended up asking Apple for help. As I expected, we cannot tell Apple/IOS not to launch APP between two subdomains with same universal links. 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",