Window.opener (Property)

A reference to the window that contained the link that opened this one.


JavaScript - 1.1
JScript - 3.0
Internet Explorer - 4.0
Netscape - 3.0
Opera - 3.0
Property/method value type:Window object
JavaScript syntax:-myWindow.opener

This allows you to build a hierarchy of parent and child windows. A window has a null value for this property if the window was opened directly by the user.

If necessary, you can modify the value in this property since it supports read and write access.


Example code:

   // Create the new window
   var myNewWindow = open('url', 'windowName');
   // Now set its opener property if it doesn't already exist
   if (!myNewWindow.opener)
   myNewWindow.opener = window;

See also:Browser version compatibility, Document object, Frame object, Window object, Window.close(), Window.frames[],

Property attributes: