Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tell parent window to go somewhere and close

Status
Not open for further replies.

gameon

Programmer
Feb 23, 2001
325
GB
Hi There, I have a place where I keep all my js functions.

One of may functions launches (user requested) popups.

I am trying to write a function that I can call from any one of the popups that tells the parent window to go to a url and the closes the pop_up.

Eg I would just include a working function like this in my inclded functions:

function GoToAndClose(theURL){
// main window go to url
window.opener=self;
window.opener.location.href=theURL;

//close the popup
this.close();
}

Naturally - the above donen't work on any browser...

Please advise...

M@)
 
Code:
window.opener.location.href=theURL
should work fine. To close the popup use
Code:
self.close();
.

I dunno why you've got the
Code:
window.opener=self;
bit in there.

HTH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top