Entry
How can I access the reference of the windows opened with javascript window.open() command?
Jul 24th, 2001 01:12
Joe Lipman, Sanjeev Kaushik,
In older versions of NN it is usually necessary to declare new windows
anyway but current versions seem to have fits about this.
If it is a window you opened from your javascript, try
myWindow = window.open("myURL","nameOfWindow","mySpecifications");
// Replace the above "my" things with own values
To refer to it later, try
myWindow.document.open("text/html");
myWindow.document.writeln
("<HTML><HEAD><TITLE>myTitle</TITLE></HEAD><BODY>myBody</BODY></HTML>")
myWindow.document.close();
// To close this window
myWindow.close();
If the command 'window.open()' was invoked from another window, try
referring to it using
notMyWindow = window.opener;
Note this is an unstable attribute in javaScript, you may not need a
reference and instead use variations such
as 'opener.parent.lowerFrame.document.body.innerHTML;' for example.