iOS Safari - What is the web to app switch policy?

I'm building an app which relies on switching from a web browser, to a native iOS app, using a universal link.


What I'm confused about is: what is the iOS policy for when the following will happen?


- An app switch can take place, vs

- The user will be redirected inside Safari


Here's the behavior I've observed so far in different cases:


1. Do app switch on page load -> goes to web

2. Do an app switch on button click -> goes to app

3. Do an app switch on button click with <1000ms delay -> goes to app

4. Do an app switch on button click with >1000ms delay -> goes to app in iOS 13, web in iOS 12

5. Open a popup window on button click, and from there do an app switch -> goes to app


I want to make sure whatever I rely on, won't be broken by a future iOS release. Is the policy here documented anywhere, or does anyone have a contact who works on iOS who can elaborate on this?


Thanks!