Created
November 15, 2020 13:35
-
-
Save AitorAlejandro/c2d86640c2a8b0b4e8fe4678b1ab5232 to your computer and use it in GitHub Desktop.
How to find out if the browser tab of the page is focused
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isBrowserTabFocused = () => !document.hidden; | |
// Example | |
isBrowserTabFocused(); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment