xxxxxxxxxx
document.addEventListener("visibilitychange", function() {
if (document.hidden) {
// The page has become hidden (user switched to another tab or window)
// You can perform some actions here if needed.
} else {
// The page has become visible again
// You can perform some actions here if needed.
}
});