# Open new window and change destination URL

**URL:** <https://forum.kirupa.com/t/open-new-window-and-change-destination-url/225114>\
**Category:** web dev\
**Created:** [May 8, 2007, 10:38pm UTC](https://forum.kirupa.com/t/open-new-window-and-change-destination-url/225114 "2007-05-08T22:38:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pod\_clock](https://avatars.discourse-cdn.com/v4/letter/p/f08c70/32.png) [@pod\_clock](https://forum.kirupa.com/u/pod_clock)\
**Post date:** [May 8, 2007, 10:38pm UTC](https://forum.kirupa.com/t/open-new-window-and-change-destination-url/225114/1 "2007-05-08T22:38:33Z")

</div>

Hi,  
I’m using this function to open a new window when a button is clicked. I’m wondering if there is a way to open the new window and at the same time change the URL of the source window so that when the new window is closed the source window underneath shows the new URL. TIA (I’m new to Javascript).

```auto

function openWindow(url) {
      var availheight=screen.availHeight;
      var availwidth=screen.availWidth;
       winStats='toolbar=no,location=no,directories=no,menubar=no,';
       winStats+='scrollbars=yes,width='+availwidth+',height='+availheight;
       if (navigator.appName.indexOf("Microsoft")>=0) {
          winStats+=',left=0,top=0';
        }else{
          winStats+=',screenX=0,screenY=0';
        }
       floater=window.open(url,"",winStats)
}

```
