2 ms·
Using the Page Visibility API
- domysee 2y agoThis worries me, it gives browser ads, like video ads, the possibility to stop when the user is not looking at it.
- bsmth 2y agoBlog post author here (thank you for sharing). I agree, unskippable ads are one of the not-so-nice uses of this API, and considered a dark pattern by most people. That's something that became apparent to me while I was working on the docs and this blog post - of course this API would be used for this purpose. There's another discussion here about this API where a reader believes it should be behind a permission flag: https://news.ycombinator.com/item?id=33965677#33994536 https://news.ycombinator.com/item?id=33965677#33994536 Personally, I think it's my role to discourage dark patterns in docs and examples and promote user agency and responsible development where I can. In this case, I'm highlighting the sustainability potential by making systems more efficient when resources are not needed. There's a section on 'patterns to avoid' in the post which talks about user control, so 'opting-in' to use of this API sounds like the better approach whether that's through in-app preferences or browser settings while there is no permission policy: https://developer.mozilla.org/en-US/docs/Web/HTTP/Permissions_Policy https://developer.mozilla.org/en-US/docs/Web/HTTP/Permission...