title: window.open() and window.close() in javascript window won't re-open after being closed
body: <p>I'm developing a web based game using <code>processing.js</code>, my question relates to pure javascript code to manage browser windows.</p>
  
  <p>The game is a maze of small browser windows (200px*200px) each border can be a wall or a passage to another window. My issue is that if I close the window I'm coming from then I try to get back it doesn't re-open, even if I use the same function that was used before.</p>
  
  <p>I've got a git repo running here : <a href="https://github.com/b2renger/TheMidst" rel="nofollow">GitHub - TheMidst</a>.</p>
  
  <p>If you want to reproduce the "error" : </p>
  
  <p>Pull the code from github:</p>
  
  <ol>
  <li>launch <code>index.html</code> (in your favorite browser, I use chrome).</li>
  <li>Don't wait up and click the <code>start button -&gt; level0.html</code> opens.</li>
  <li>Go on the right by clicking on the right hand side of the <code>canvas-&gt;</code>
  <code>level1.html</code> opens.</li>
  <li>Go back on your <code>steps -&gt; level0.html</code> still opens.</li>
  <li>Go back on the right towards <code>level1.html</code> and it will not be re spawn
  ... => this is my issue.</li>
  </ol>
  
  <p>/js -> contains a windowScripts.js that handles opening and closing of windows through functions, this is the heart of my window manager and it's buggy.</p>
  
  <p>/levels -> contains each level as a html page.</p>
  
  <p>/pd ->  contains the sound of the game as Pure-Data patches (yeah !)</p>
  
  <p>The game is far from finished yet, so everything is far from perfect. Any help would be greatly appreciated.</p>
  
  <p>Cheers.</p>
  
  <p>edited to add some code</p>
  
  <p>to open a popup i use : popUp(1); //1 being the number of the level i want to open.</p>
  
  <p>this relates to this js function</p>
  
  <p>function popUp(winNum) {</p>
  
  <pre><code>var windowFeatures = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left="+(winVars[winNum][0])+",top="+(winVars[winNum][1])+",width="+winVars[winNum][2]+",height="+winVars[winNum][3];
  
  
  windows[winNum] = window.open( "level"+winNum+".html", "myWindow"+winNum, windowFeatures);
  
  
  windows[winNum].moveTo(winVars[winNum][0],winVars[winNum][1]);
  </code></pre>
  
  <p>}</p>
  
  <p>all my windows properties are stored in arrays</p>
  
  <p>to close a window I use : closeWindows(0); // 0 being the number of the window I want to close.</p>
  
  <p>function closeWindows(winNum2){</p>
  
  <p>setTimeout (widows[winNum2] = window.close(),50);
  }</p>
  
  <hr>
  
  <p>Actually I had a bit of confusion beetween parent windows etc...</p>
  
  <p>using "window.opener.popUp(myPopup)" did fix the issues</p>
  
  <p>some changes have been made on the github repo, if you have the same issue you can still refer to the github repo.</p>
  
  <p>Cheers</p>