Update snippet descriptions
This commit is contained in:
@ -3,9 +3,9 @@ title: isBrowserTabFocused
|
||||
tags: browser,beginner
|
||||
---
|
||||
|
||||
Returns `true` if the browser tab of the page is focused, `false` otherwise.
|
||||
Checks if the browser tab of the page is focused.
|
||||
|
||||
- Use the `Document.hidden` property, introduced by the Page Visibility API to check if the browser tab of the page is visible or hidden.
|
||||
- Use the `Document.hidden` property, introduced by the [Page Visibility API](https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API) to check if the browser tab of the page is visible or hidden.
|
||||
|
||||
```js
|
||||
const isBrowserTabFocused = () => !document.hidden;
|
||||
|
||||
Reference in New Issue
Block a user