Window open() Method - Use the opener property to return a reference to the window that created the new window: - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window open

Description

Window open() Method - Use the opener property to return a reference to the window that created the new window:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*from www.  ja v a2s.c  o  m*/
    var myWindow = window.open("", "myWindow", "width=200,height=100");
    myWindow.document.write("<p>This is 'myWindow'</p>");
    myWindow.opener.document.write("<p>This is the source window!</p>");
}
</script>

</body>
</html>

Related Tutorials