In general case a script can't get from the browser the info about opened pages because of security purposes.
Maybe it can be handful to store all links to child pages loading from current page and check every time before using window.open
var openedPages = []
function openUrl(url)
{
if (!isWindowActive(url))
{
var win = window.open(url, '_blank')
// also it's good to prevent duplicate url's, but I omit that stuff for simplicity
openedPages.push({ 'url': url, 'win' : win })
}
}
function isWindowActive(url)
{
for(var i = 0; i < openedPages.length; ++i)
{
var page = openedPages[i]
if (page.url === url)
{
return !page.win.closed
}
return false
}
}