title: setTimeout does not work as expected on IE11
body: <p>I have the following web page:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Wait until closed&lt;/h1&gt;
  &lt;script&gt;
  
  function wait(popup){
        if (!popup.closed){
          setTimeout(wait,1000,popup);
        } else {
          alert('closed');
        } 
      }
  
  var popup = window.open("http://www.google.com", '', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes, width=1000 , height=800, top=' + screen.top + ', left=' + screen.left);
  
  wait(popup); 
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I open it with Chrome or Firefox, I see the message 'closed' after I close the popup. In IE11 however nothing happens. What is the explanation of this difference in behaviour? (i.e. which part of the standards IE11 does not adhere to, or interpret differently in this case, if at all?)</p>
  
  <p><strong>EDIT:</strong> reading the suggested answers, I tried to change  <code>setTimeout(wait,1000,popup)</code> to <code>setTimeout(function() {wait(popup);},1000)</code>, like this:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Wait until closed&lt;/h1&gt;
  &lt;script&gt;
  
  function wait(popup){
        if (!popup.closed){
          setTimeout( function() {
              wait(popup);
          }, 1000 );
        } else {
          alert('closed');
        } 
      }
  
  var popup = window.open("http://www.google.com", '', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes, width=1000 , height=800, top=' + screen.top + ', left=' + screen.left);
  
  wait(popup); 
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>but this does not work either.</p>
  
  <p><strong>EDIT:</strong> The comments indicate that this is a duplicate, but since trying to change the code according to the suggested answers did not work for me until now, I modify the question by asking to change the above code so that it works in IE11 (hope that this is allowed by SO rules). The code shown does not work.</p>