Document.hidden property, introduced by the Page Visibility API to check if the browser tab of the page is visible or hidden.const isBrowserTabFocused = () => !document.hidden;
isBrowserTabFocused(); // trueSubscribe to get resources directly to your inbox. You won't receive any spam! ✌️