Last active
January 29, 2019 06:38
-
-
Save mcnaveen/4a2c5e7ed2417811896d7709c64af45f to your computer and use it in GitHub Desktop.
Change Title Bar text, When switching to Other Tab
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
== Place the Below code, Above the </head> Tag. === | |
== For WordPress, Use the Plugin. " https://wordpress.org/plugins/code-snippets/ == | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> | |
<script> | |
$(function () { | |
var message = "Hey, come back!"; | |
var original; | |
$(window).focus(function() { | |
if(original) { | |
document.title = original; | |
} | |
}).blur(function() { | |
var title = $('title').text(); | |
if(title != message) { | |
original = title; | |
} | |
document.title = message; | |
}); | |
}); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment