Skip to content

Instantly share code, notes, and snippets.

@isaumya
Created December 11, 2016 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaumya/ee6df6ac66755e0d7c0c3b099cda9961 to your computer and use it in GitHub Desktop.
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
/* 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