Created
December 11, 2016 10:35
-
-
Save isaumya/ee6df6ac66755e0d7c0c3b099cda9961 to your computer and use it in GitHub Desktop.
Change the title of the page if user click on some other tag
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
/* Let's say the normal title of page in the <title> tag is => iSaumya.com | |
* but when user will go to some other tab of the browser, it will be changed | |
* from iSaumya.com to 。◕‿◕。 iSaumya.com | |
**/ | |
var original_title = document.title; | |
document.addEventListener("visibilitychange", function(){ | |
if(document.hidden) | |
document.title = "。◕‿◕。 iSaumya.com"; | |
else | |
document.title = original_title; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment