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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…