Window parentProperty
Window Object
Definition and Usage
The parent property returns the parent window of the current window.
Syntax
window.parent
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the parent property.
Example
Example
When opening a new window, display an alert in the parent window:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
</head>
<head>
<script>
function openWin(){
window.open('','','width=200,height=100');
alert(window.parent.location);
}
</script>
</head>
<body>
<input type="button" value="Open Window" onclick="openWin()">
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
</head>
<head>
<script>
function openWin(){
window.open('','','width=200,height=100');
alert(window.parent.location);
}
</script>
</head>
<body>
<input type="button" value="Open Window" onclick="openWin()">
</body>
</html>
Try it Yourself »
Window Object Other Extensions