【问题标题】:JavaScript: check for window exists && is/is not minimizedJavaScript:检查窗口是否存在&&是/未最小化
【发布时间】:2011-08-05 22:26:44
【问题描述】:

我想确保之前打开的任何弹出窗口不仅存在,而且没有被最小化。 earlier discussion 谈到了检查窗口是否存在。我猜测(希望!)将焦点放在已经打开的窗口上,如果它已被最小化,它将恢复该窗口。

是这样,还是不是?

谢谢!

【问题讨论】:

  • @Dr.Molle -- danke sehr!

标签: javascript popup window exists


【解决方案1】:

假设“窗口”是您对选项卡或浏览器窗口的引用,您可以同时使用这些方法检测焦点并设置它:

function detectFocus(state){
   return "Window is now "+state;
}
window.onfocus = function("in focus")
window.onblur = function("not in focus")
/*You then can set state with this method of window:*/
if(needToRestore==true){window.focus}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-31
    • 2011-11-13
    • 1970-01-01
    • 2021-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多