Universal Link Failures in Safari

We encountered an issue with universal links where the link failed to open the iOS application from Safari when triggered by an javascript outside a click event.

However, when we modified the code to open the link directly via a user click, the application launched as expected. Based on our testing, this issue seems to occur only when there is information for the application cached in Safari (i.e. IDP page cached, redirects to our app, javascript based universal link navigation fails).

Here is a code example of what caused the universal link failure:

const openUniversalLink = () => {
     buttonClicked = True
}

useEffect(()=> {
        if (buttonClicked) {
            window.location.href = universal_link
        }
}

<Button
     onClick={openUniversalLink}
/>

Here is a code example of what caused our universal links to open successfully:

const openUniversalLink = () => {
     window.location.href = universal_link
}

<Button
     onClick={openUniversalLink}
/>

Are there defined practices of when we are able to open universal links triggered by javascript vs when they must be opened directly through user action?

Thank you for the post. It appears that the link handling is functioning as intended, as the JavaScript client already handles the link, potentially preventing a redirect. However, it is important to note that the link is not being modified, only handled by the client and finally making the request.

I would like to request that you file a bug report so that we can investigate this issue further. At this time, it is unclear whether the link should open the app as the browser makes the final request, it should I believe, even though it is being processed within a JavaScript function.

Could you kindly provide a simple project that demonstrates the issue we are experiencing? Alternatively, could you share a published website? Please include the links to the AASA file so that we can verify the links that should open the application.

Once you open the bug report, please post the FB number here for my reference.

If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?

Albert Pascual
  Worldwide Developer Relations.

Universal Link Failures in Safari
 
 
Q