Please Help : Check for existing window

S

shirantha

Hi,

I need to check for a particular window which I opened as a popup,
already exists, before I try to open the same again. I achieved that
with the following code. So this is fine.

var myWin = null;
function openPopup(aURL){
if (( myWin==null) || myWin.closed) {
myWin = open(aURL,"myWin");
}

/* Window is already opn, thus maps the url to the same window
and give focus */
else {
myWin.location = aURL;
myWin.focus();
}
}

Now my problem is I need to do a similar check for a page thats been
href to the top.location
top.location=aURL;

In this situation if this same code runs again, i need to check if this
window is already open, and if so not to open it. Can it be done in a
similar way like the above.

Thanks for your time
Shiran.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,812
Messages
2,569,694
Members
45,478
Latest member
dontilydondon

Latest Threads

Top