3

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?

Henry
  • 61
  • 1
  • 7

2 Answers2

3

You can disable Universal links by blacklisting the paths in your AASA file. Adding NOT before the path in your AASA file won't trigger app open for your 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

udbhateja
  • 948
  • 6
  • 21
  • I don't think in paths we can specify protocol and domain? But thanks for your answer, i will try it no matter what. – Henry Oct 30 '20 at 08:34
  • We can specify url or a certain path with wildcard characters in "paths". I have done same for my applications. Follow the apple documentation for the same. – udbhateja Oct 31 '20 at 09:12
  • i think if put `NOT http://subdomainA.mywebsite.com/test.html`, that simply means when a user clicks a link to `http://subdomainA.mywebsite.com/test.html`, it won't launch the APP? But my problem is, if the user visits `http://subdomainA.mywebsite.com/test.html` in browser, and click the link that links to `http://www.mywebsite.com/`, the App will be launched. But i don't want that happen. what i want to achieve is, if it is in `subdomainA.mywebsite.com`, if there is any link links to `http://www.mywebsite.com/`, it won't launch the APP. Is it possible to achieve that? – Henry Nov 01 '20 at 10:20
3

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",

Henry
  • 61
  • 1
  • 7