切换标签离开当前页面时改变title提示

<script>  
// 浏览器标题切换  
var OriginTitile = document.title;    // 保存之前页面标题  
var titleTime;  
document.addEventListener('visibilitychange', function(){  
    if (document.hidden){  
        document.title = 'Google一下,你就知道';  
        clearTimeout(titleTime);  
    }else{  
        document.title = 'Google一下,你就知道';  
        titleTime = setTimeout(function() {  
            document.title = OriginTitile;  
        }, 2000); // 2秒后恢复原标题  
    }  
});  
</script>