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