ioshttp-redirectdeep-linkingios-universal-linksaasa

iOS - Universal links - Preventing a redirect in browser from opening installed application


In a situation where a user has our mobile application installed on iOS, but uses our website via Safari browser. User navigates normally through the web pages, however...

Going through checkout/purchase process, we use an externally hosted card payment service, which after card input, redirects the user to the card-issuer's 3DS authentication service, then on completion, the user is redirected back to a page on our site.

(~/cart.php?target=Payment_return)

In this situation, Universal linking is stepping in and causing the redirect link to open our installed app, rather than continuing in the web browser. [this doesnt happen on android devices] This is causing payment processing to complete, but user is lost in the checkout process.

our AASA association file contains:

 "paths": ["NOT *target=product_search*","NOT /cart.php?target=payment_return*","*"]

but this exclusion does not seem to be honoured.

The team is stumped, and would appreciate any advice here.

Clearly this is related to the user's own preference as to the way he last opened a link to either our website or app, and iOS 'remembering' that selection as the default; (the situation doesnt occur if the users last choice was to open our links in the browser); nonetheless the redirection while working IN the browser is unwelcome, and that the AASA exclusion doesnt seem to be working.

We've missed something here? or there must be a lot of others in this same boat, surely? help.

tia.


Solution

  • From the docs, refer here:

    Note that only the path component of the URL is used for comparison. Other components, such as the query string or fragment identifier, are ignored.

    That's probably why exclusions are not honored.

    I don't know if you need to support below iOS 13, but if you are targeting iOS 13 and upper versions, there is still hope, check here for detailed documentation.

    In your case, it can be something like (I didn't try it, just to give you an idea):

    { "applinks": {
      "details": [
           {
             "appIDs": [...],
             "components": [
               {
                  "/": "/cart.php*",
                  "?": { "target": "payment_return" },
                  "exclude": true,
                  "comment": "Matches any URL whose path starts with cart.php and which has a query item with name 'target' and a value payment_return"
               }
             ]
           }
       ]}, ...}
    

    And do not forget reinstalling the app after changing AASA on the website.