1var isOldTitle = true;
2var oldTitle = "oldTitle";
3var newTitle = "newTitle";
4var interval = null;
5function changeTitle() {
6 document.title = isOldTitle ? oldTitle : newTitle;
7 isOldTitle = !isOldTitle;
8}
9interval = setInterval(changeTitle, 700);
10
11$(window).focus(function () {
12 clearInterval(interval);
13 $("title").text(oldTitle);
14});