SOURCE

var CurrentActive;
window.onfocus = function() {
        CurrentActive = true;
        document.body.innerHTML +="当前窗口被激活";
}
window.onblur = function() {
        CurrentActive = false;
        document.body.innerHTML +=  "当前窗口没有激活";
}
console 命令行工具 X clear

                    
>
console