How to get the references of all already opened child windows

javascript, window.open

Solution

If you don't want to change your current code, you can simply override `window.open()` function:

var openedWindows = [];
window._open = window.open; // saving original function
window.open = function(url,name,params){
    openedWindows.push(window._open(url,name,params));
    // you can store names also...
}

Run this code before calling `window.open()`. All the references to the opened windows will be stored in `openedWindows` array. You can access them anywhere you want

Problem

I want to get the references of all already opened child windows. is there any way? I am not using `child = window.open(....)` just using `window.open(....)` and opening multiple child windows.

Original source

Related problems