How to get the references of all already opened child windows

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

Leave a Comment