Document: hidden property


目录

The Document.hidden read-only property returns a Boolean value indicating if the page is considered hidden or not. This can be used to check whether the document is in the background or in a minimized window, or is otherwise not visible to the user.

The Document.visibilityState property provides an alternative way to determine whether the page is hidden.

Value

A Boolean value, true if the page is hidden, and false otherwise.

Examples

document.addEventListener("visibilitychange", () => {
  console.log(document.hidden);
  // Modify behavior…
});

Specifications

Browser compatibility

See also


版本号 #3
由 壳壳虫 创建于 2026-10-31 03:27:53 UTC
由 cocobook-sync 更新于 2026-11-04 17:33:49 UTC