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
There is a Page Visibility API available: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
document.addEventListener("visibilitychange", handleVisibilityChange, false)