如何判断Java中是否存在窗口? [英] How to tell if a window exists in Javascript?

查看:49
本文介绍了如何判断Java中是否存在窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了查看特定脚本打开的窗口是否仍处于打开状态的方法,但是如果没有打开该怎么办?

I've seen ways of seeing if a window a particular script opened is still opened, but what if it didn't?

我有一个小窗口,有一个按钮可以单击以加载大窗口.当我关闭大的那个时,我希望一个特定的 onUnload onBeforeUnload 在小那个关闭时触发.如果它仍然打开,则不会执行这些过程.我可能只是脑子里放屁而已,但我不知道如何检查另一个窗口是否打开.大的没有打开它,所以我不能简单地记录打开它的手柄.

I have a small window that has a button to click to load the large window. When I close the large one, I want a particular onUnload or onBeforeUnload to fire iff the small one is closed; if it's still open, those procedures will not fire. I may be having simply a massive brain fart but I can't figure out how to check if the other window is open. The big one isn't opening it, so I can't simply record the handle from opening it.

简而言之:如果窗口A打开了窗口B,如何在窗口B中检查窗口A是否仍然存在?

In shorter terms: If window A opened window B, how can I check within window B if window A still exists?

推荐答案

if(window.opener && !window.opener.closed)
    alert('Yup, still there.');

这篇关于如何判断Java中是否存在窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆