Using the opener property to return a reference to the window that created the new window:
Click the button to write some text in the new window and the source (parent) window.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from w ww . j a v a 2 s . co 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>