Document: hidden property
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
这篇文档对你有帮助吗?
谢谢你的反馈!