title: window.close(); after window.print(); javascript
body: <p>I need a js code which will close window right after appearing of pop up print window. Here is my code: </p>
  
  <pre><code>&lt;a href="javascript:;" onclick="print()"&gt;Print&lt;/a&gt;
  
  function print()
  {   
      win = window.open();
      win.document.write('&lt;html&gt;&lt;head&gt;blablabla.......');
      win.window.print();
      win.window.close();
  }
  </code></pre>
  
  <p>But it doesn't work because window closes before it pop up.</p>