Starting from visibilitychange Not Working in Safari

Each section runs the same snippet shown above its result. The buttons replay browser paths such as tab switching, link navigation, page hiding, freezing, resuming, and discarding.

1. visibilitychange misses Safari link navigation

Code:

Result:

2. pageshow and pagehide describe entering and leaving

Code:

Result:

3. Register visibilitychange on document, page events on window

Code:

Result:

4. beforeunload is only for blocking desktop exits

Code:

Result:

5. Combine visibilitychange and pagehide without duplicate beacons

Code:

Result:

6. Page lifecycle statechange output

Code:

Result:

7. Report when passive becomes hidden

Code:

Result:

8. Detect freeze and resume

Code:

Result:

9. Detect reload after discard with document.wasDiscarded

Code:

Result: