[英]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.