faqts : Computers : Programming : Languages : JavaScript : Windows

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

56 of 70 people (80%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

How can I change the content of the opener window when a link in the child window is clicked on?

Dec 4th, 2002 19:10
Ryan Buterbaugh, Rey Nuņez, Ulrich Hendersen,


this code should do the trick (very simple, im sure you could have 
thought of it)
window.opener.location.href = "http://www.your.url.com/";
----------
This is one other way to do it. In the document that calls to open the 
child window, add:
self.name = "mainWindowName";
For example, always open the popup window thru a function like this:
function openPop(url,popWinName,features){
window.open(url,popWinName,features);
self.name = "main";
}
What this essentially does is assign the name "main" to the current 
window (the window that opened the popup). Then in the links in your 
child window, add target = "main".
This is more reliable than using window.opener, as the window.opener 
object has known bugs in IE.