Created
March 16, 2018 06:25
-
-
Save abinavseelan/71df6d35e62612dde33e05ab9e332b92 to your computer and use it in GitHub Desktop.
(3) Page Visibility API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<body> | |
<script type="text/javascript"> | |
document.addEventListener('visibilitychange', () => { | |
if (document.visibilityState === 'hidden') { | |
document.title = '😴'; | |
} | |
if (document.visibilityState === 'visible') { | |
document.title = '😁'; | |
} | |
}); | |
</script> | |
</body> | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment