IIRC this comes down to disagreements between browser vendors as to what is and what isn't potentially harmful (for a wide definition of harmful) detection of user behavior.
I don't remember the details, but expect browsers to differ on details of this API basically forever.
It might make sense to detect page visibility prior to loading a pay-per-load API like Mapbox GL JS, Apple Maps on Web, etc.
The scenario I imagine is:
1. Your map is loaded
2. User opens a new tab (your map is now in a background tab)
3. User restarts browser and existing tabs are loaded
4. You get charged for an API load even though the page is not visible
Does anyone know if this is the case?
Edit: also analytics. If you don't load your GA until page is visible, I wonder what impact that has on your visitor numbers
I tried using the page visibility API to refresh displayed data when the user returned to the page after being away for a while. It's more efficient than needlessly polling when no one's around to see.
I discovered a bunch of these edge cases and had to abandon the approach - it just wasn't reliable. The page would fail to recognize departure + return in too many scenarios and so wouldn't refresh.
Off topic: This page is yet another example of many, many websites that display a useless horizontal scrollbar. Non-overlay scrollbars simply do not work with elements that are set to a width of 100vw. Using 100vw is almost always a mistake.
Feels like this API is designed for web ads
There are still very few addons you can install on Firefox for Android (without a dev version and a bunch of hassle), but it's telling that one of the few addons that anyone can install disables this API: https://addons.mozilla.org/android/addon/video-background-pl...