How to change tab name in browser when user goes off from my site

$(window).focus(function() {
   document.title = 'defult title';
});

$(window).blur(function() {
   document.title = 'you went?';
});

You need to make use of the onblur and onfocus events for the window object.

So something like this (this is native javascript, no jquery).

<script>

window.onblur = function () { document.title = 'you went?'; }

window.onfocus = function () { document.title = 'you came back'; }

</script>