Back to Content

Document: hidden property

files/en-us/web/api/document/hidden/index.md

latest616 B
Original Source

{{ ApiRef("DOM") }}

The Document.hidden read-only property returns a Boolean value indicating if the page is considered hidden or not.

The {{domxref("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

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("Document.visibilityState")}}