不,不是真的.可能是您可以将处理程序分配给窗口的焦点/模糊事件,将布尔值设置为true或false,并使用它来确定它是否具有焦点.
这条线上的东西:
window.hasfocus = false;
window.onfocus = function(){
this.hasfocus = true;
}
window.onblur = function(){
this.hasfocus = false;
}
Run Code Online (Sandbox Code Playgroud)