<story><title>Lesser-known JavaScript APIs</title><url>https://www.smashingmagazine.com/2022/09/javascript-api-guide/</url></story><parent_chain></parent_chain><comment><author>alwayslikethis</author><text>I feel like Page Visibility API should be locked behind a permission toggle, which would ask whenever the website tries to listen to any of those events, and  will not trigger the events until the user agrees to give the permission (whether or not the user grants the permission should not be revealed to the website). The ability for a website to see when you click on things outside of the page itself (either by changing active window or tab) is quite unexpected from an end-user perspective, and its use in various &amp;quot;ed tech&amp;quot; websites to detect alleged cheating[1] is frightening, to say the least. Other than that, it&amp;#x27;s also used in many other anti-user implementations of ads or other content in order to force you to watch them in their entirety.&lt;p&gt;Edit: If you want to protect yourself from such abuse, try an extension that spoofs the API.&lt;p&gt;You can try: &amp;quot;Always active window&amp;quot; on Firefox or &amp;quot;Don&amp;#x27;t make me watch&amp;quot; on Chrome.&lt;p&gt;Test it with this website (not mine): &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;testdrive-archive.azurewebsites.net&amp;#x2F;Performance&amp;#x2F;PageVisibility&amp;#x2F;Default.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;testdrive-archive.azurewebsites.net&amp;#x2F;Performance&amp;#x2F;Page...&lt;/a&gt;&lt;p&gt;1. &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;prioritylearn.com&amp;#x2F;teachers-canvas-tabs&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;prioritylearn.com&amp;#x2F;teachers-canvas-tabs&amp;#x2F;&lt;/a&gt;</text></comment>
<story><title>Lesser-known JavaScript APIs</title><url>https://www.smashingmagazine.com/2022/09/javascript-api-guide/</url></story><parent_chain></parent_chain><comment><author>uzername</author><text>Page Visibility API is used in tools like react query, where it will show the page with the existing cached data, but refetch in the background upon a page visibility event. It feels natural for some apps to have this update-on-focus behavior, and it&amp;#x27;s nicer than polling with set interval.&lt;p&gt;Intl API is great, but I feel it&amp;#x27;s somewhat hamstrung because Node doesn&amp;#x27;t have matching APIs.</text></comment>