Too Long; Didn't Read
The Page Visibility API is especially useful for saving resources and improving performance by letting a page avoid performing unnecessary tasks when the document isn't visible. Pages only become hidden when the user switches tabs or minimizes the browser window containing the tab. API sends a visibilitychange event to let listeners know the state of the page has changed. API provides events you can watch for to know when a document becomes visible or hidden, as well as features to look at the current visibility state. API is available in modern browsers (Firefox 58+ Chrome 57+)