Alert the location of the parent window when opening a new window:
window.open("", "", "width=200, height=100"); alert(window.parent.location);
Click the button to alert the location of the parent window when opening the new window.
<!DOCTYPE html> <html> <body> <p id="demo"></p> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from w w w .ja v a 2s. co m window.open("", "", "width=200, height=100"); document.getElementById("demo").innerHTML = window.parent.location; } </script> </body> </html>