开发者

How can I access the children popup windows without knowing their handle names?

I'm trying to see which windows are being opened, but I dont know the window names as they are called.

How can I access them in JAVASCRIPT/DOM/or JQUERY?

Th开发者_运维问答anks!


Every example I've seen requires the name of the window. If you can't control that yourself, because you're using a complicated/obfuscated library or a generic greasemonkey script for a complicated website, say, you could try and monkey patch the places the window is opened. Assuming windows are all opened via window.open, you could do:

var allWindows = []
var _windowOpen = window.open;
window.open = function() {
  var newWindow = _windowOpen.apply(this, arguments);
  allWindows.push(newWindow);
}

allWindows will then contain the list of all windows that have been opened so far. You can loop through them at any time and check the "closed" property to find those that are still open. i.e. you deduce a window is open if !win.closed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜