Click to See Complete Forum and Search --> : close a pop-up from main window


brigsM
10-15-2003, 02:12 PM
Hi…

My site when opened launches a pop-up that serves as an index listing of other pages to load in to the main window.

I wish to be able to click on a link on any page loaded in the main window and close the pop-up using window.self.close

Could someone please advise me of how I reference the pop-up from any of the pages in the main window. I’m using top.opener.location='pageNumber.html' to load the main windows from the index pop-up so I’m asking what the opposite would be..

Thx….

gil davis
10-15-2003, 04:49 PM
When you open a pop-up (IMHO a sin against humanity), you should give it a name and also assign the object to a variable.
var popup = window.open("someUrl", "someName", "someParameters");
Then in the page that opens the pop-up, you can close the pop-up by using
popup.close();
In some other window, you can either reference the handle through some other relationship, or you can establish a new relationship by using:
var popup = window.open("", "someName");
followed closely by
popup.close();