Henry
Henry

Reputation: 71

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?

Upvotes: 4

Views: 5213

Answers (2)

Henry
Henry

Reputation: 71

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

Upvotes: 3

udbhateja
udbhateja

Reputation: 978

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

Upvotes: 3

Related Questions