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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning data to Parent Window 1

Status
Not open for further replies.

david6633

Programmer
Jul 28, 2003
39
GB
The scenario is that I have a link on a page which opens in a popup window - no problem with that.

In the popup window there are links and what I want to do is open the page back in the parent window and close the popup. Is this possible?

I have tried searching this forum but cannot seem to find the answer.

David
Remember: You only know what you know
and - you don't know what you don't know!
 
One way would be to have a hidden text field on the parent page, with JS update the hidden field with the URL, call a function on the parent page which closes the popup window then changes the page location to the URL held in the hidden input field.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
I have been doing some "digging around" and have sort of got it working with this function:
Code:
function popup_return(url)
{
	window.opener.location.href(url);
	self.close();
}
When I say sort of got it working it works perfectly in IE but in Firefox the page is displayed in the popup window and not the parent window. The JS Console in FF says "window.opener.location.href is not a function"

Any advice would be appreciated.

David
Remember: You only know what you know
and - you don't know what you don't know!
 
just try this instead:

Code:
function popup_return(url)
{
    window.opener.location = url;
    self.close();
}

another thing you might want to play around with is the target attribute of the anchor tag. while it's not XHTML strict compliant, it gets the job done nicely.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Thanks that works just great!

David
Remember: You only know what you know
and - you don't know what you don't know!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top