Created
March 19, 2018 15:37
-
-
Save coelhoadler/85349d42d490ac2840393e370327cf0a to your computer and use it in GitHub Desktop.
Testing the visibility API. Every time when I change the browser tab, the title page is changed.
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>π</title> | |
| </head> | |
| <body> | |
| <script type="text/javascript"> | |
| document.addEventListener('visibilitychange', (event) => { | |
| if (document.visibilityState === 'hidden') { | |
| document.title = 'π΄'; | |
| } | |
| if (document.visibilityState === 'visible') { | |
| document.title = 'π'; | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment