Skip to content

Instantly share code, notes, and snippets.

@seanwalsh
Last active August 29, 2015 14:03
Show Gist options
  • Save seanwalsh/8b6fe8fb96eeda416121 to your computer and use it in GitHub Desktop.
Save seanwalsh/8b6fe8fb96eeda416121 to your computer and use it in GitHub Desktop.
Change the title tag when the user goes to another window/tab.
window.onblur = function () { document.title = 'Your new HTML Title tag'; }
window.onfocus = function () { document.title = 'The default title tag'; }
// Change Title Tag
var currentTitle = document.title;
window.onblur = function () { document.title = 'Hey, over here.'; }
window.onfocus = function () { document.title = currentTitle; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment