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?