获取打开的弹出窗口列表 [英] Get list of opened popup windows

查看:84
本文介绍了获取打开的弹出窗口列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我是否可以获得由window.open javascript函数调用打开的弹出窗口列表。

I would like to know if I can get a list of popups opened by window.open javascript function call.

我希望在所有这些页面关闭后运行一些代码。我不介意解决方案是普通的javascript还是JQuery。

I want to run some code after all these pages are closed. I don't mind if the solution was plain javascript or JQuery.

提前致谢。

推荐答案

不,你无法通过 window.open (遗憾地)得到页面打开的窗口列表。你必须在打开它们时跟踪它们(假设是你打开它们)。

No, you can't get a list of windows opened by the page via window.open (sadly). You'll have to keep track of them as you open them (assuming it's you who opens them).

如果你要做更现代风格的弹出窗口(定位元素在页面中作为虚拟窗口打开),当然你可以通过做一个简单的选择器查询来获得它们的列表(只需在它们显示时向它们添加一个类,然后在DOM中查询具有该元素的元素) ()

If you were to do the more modern style of popup instead (positioned elements opened as virtual windows within the page), then of course you could readily get a list of them by doing a simple selector query (just add a class to them when they're showing, and then query the DOM for elements with that class).

这篇关于获取打开的弹出窗口列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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