Ruphaa's Notes

How to find out if the browser tab of the page is focused?

js

const isBrowserTabFocused = () => !document.hidden;

// Example
isBrowserTabFocused(); // true