Look into using the page visibility api to detect when window is active. https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
Look into using the page visibility api to detect when window is active.
https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API