Zac
Zac

Reputation: 2081

Prevent IOS/Safari From Opening App From Link

I have an application that has an IOS app and a web app.

When a user forgets their password, they get an email with this link:

https://my.domain.com/SetPassword/?code=some_code_here

The IOS app has this domain also tied into its settings ( deep linking domain permission stuff) and when users click this link in their email on their IOS device, it opens the app - not the web page to reset their password.

Is there a way to prevent this? Open the webpage in a browser, not the app?

Adding the target="_blank" does not work.

here is the source <a> in the email: (formatted for readability)

<a style="color:#c5534d;
font-family:verdana,sans-serif;
font-size:12px;
font-weight:bold"
href="https://my.domain.com/SetPassword/?code=some_code_here_test_1"
target="_blank" 
data-saferedirecturl="https://www.google.com/url?q=https://my.domain.com/SetPassword/?code=some_code_here_test_1">
     https://my.domain.com/SetPassword
</a>

Upvotes: 3

Views: 3386

Answers (1)

Zac
Zac

Reputation: 2081

To fix this, I had to add a apple-app-site-association file and make this route exclusive to NOT open to the mobile app.

I had to include "NOT /myroute/*" to the paths array. The NOT prevents this route from opening the app.

The file for me looks something like this:

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "62AGA19JEA.com.domain.subhost",
                "paths": [
                    "*",
                    "NOT /SetPassword/*"
                ]
            }
        ]
    }
}

Documentation: https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html

Upvotes: 3

Related Questions