Properties


opener Property

Sets or retrieves a reference to the window that created the current window.

Syntax

[ sWindow = ] object.opener

Possible Values

sWindowString or Integer that specifies or receives the window reference.

The property is read/write. The property has no default value.

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are not supported in IE8 mode. For more information, see About Dynamic Properties.

Remarks

The opener property is available only for frame and iframe pages.

Standards Information

There is no public standard that applies to this property.

Applies To

window, Window Constructor
Tags :


Community Content

Manish 3177
window.opener - example (one that's not unecessarily confusing)

You can use window.open to open a new window. For example the following code opens a new window without toolbars, menubars, etc.

<script language="javascript" type="text/javascript"> 
function open_child()
{
/* this opens a new window without toolbars, menubars, etc. */
lovechild = window.open("file_you_want_to_open.html", "lovechild","height=679, width=1200,resizable=0,menubar=0,toolbar=0,location=0,directories=0,scrollbars=0,status=0")
}
</script>
</head>
<body onload="open_child()">

</body>


In the newly opened window, you can access the original window by using window.opener. For example the following code closes the original window that opened it.

file_you_want_to_open.html:

<script language="javascript" type="text/javascript"> 
function close_opener()
{
/* this closes the window that opened this one. */
window.opener.close();
}
</script>
</head>
<body onload="close_opener()">

</body>


Page view tracker