You can also try and use VisibilityAPI.
document.addEventListener("visibilitychange", function() {
if (document.hidden){
console.log("Browser tab is hidden")
} else {
console.log("Browser tab is visible")
}
});
More Related Contents:
- 5 stars and the golden 5 stars are not together (When browsing with Internet explorer)
- JavaScript get clipboard data on paste event (Cross browser)
- How to get the browser viewport dimensions?
- JS li tag onclick not working on IE8
- Browser detection versus feature detection
- How to build PDF file from binary string returned from a web-service using javascript
- OnChange event handler for radio button (INPUT type=”radio”) doesn’t work as one value
- How to compress an image via Javascript in the browser?
- How is the default submit button on an HTML form determined?
- Show datalist labels but submit the actual value
- Jquery load() only working in firefox?
- How do I get the (x, y) pixel coordinates of the caret in text boxes?
- Cross-browser bookmark/add to favorites JavaScript [duplicate]
- How to make Internet Explorer emulate pointer-events:none?
- Watch for object properties changes in JavaScript [duplicate]
- Enter key press behaves like a Tab in Javascript
- How can I make event.srcElement work in Firefox and what does it mean?
- Cross-browser method for detecting the scrollTop of the browser window
- Why can’t I pass “window.location.reload” as an argument to setTimeout?
- Setting minimum size limit for a window minimization of browser?
- Is JSON.parse supported by all major browsers? [duplicate]
- Javascript maximum size for types?
- window.focus() not working in Google Chrome
- Find the exact height and width of the viewport in a cross-browser way
- How can I know whether refresh button or browser back button is clicked in Firefox? [duplicate]
- How to display text in the browser status bar?
- cross-browser resize browser window in JavaScript
- Retrieving HTML attribute values “the DOM 0 way”
- What’s the most concise cross-browser way to access an element’s window and document?
- javascript array.sort with undefined values