Is it possible to detect current page is in alt-tab? This code works only if a new tab in browser is opened:
(function() {
var hidden = \"hidden\";
// S
You can simply use the onfocus event on window, like in:
window.onfocus = function() {
console.log('Got focus');
}
If needed, you can also use onblur for a more acute handling.
There is a Page Visibility API available: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
document.addEventListener("visibilitychange", handleVisibilityChange, false)