The parent
property returns the parent window of the current window.
parent |
Yes | Yes | Yes | Yes | Yes |
window.parent
The parent window of the current window.
The following code shows how to output the location of the parent window when opening the new window.
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<!--from ww w.j a v a2 s. c o m-->
<script>
function myFunction() {
window.open("", "", "width=200, height=100");
console.log(window.parent.location);
}
</script>
</body>
</html>