Changing Your Site's Meta Title When Clicking Out

This is a neat trick I recently learned how to do. This is for when you click out of your site tab, its current Meta Title can change to anything you want.

This will go before your closing body tag (title will go where ‘Your text here’ is).


jQuery(document).ready(function($) { var titles = []; titles.push(jQuery('title').text()); titles.push('Your text here'); var count = 0; jQuery(window).focusout(function(e) { jQuery('title').text(titles[1]); }); jQuery(window).focusin(function(e) { jQuery('title').text(titles[0]); }); });</script>


Live (go to and then open a new tab):

Let me know what you think!

May not be an entirely good idea. Google does execute JavaScript before it indexes your site. You wouldn’t want your website to show up in Google as “Come back soon!”.

That is something I have been curious about since learning this, is there anyone who can confirm that this would be an issue?

You can leave the script up as an experiment to see what Google displays your site as.

1 Like