title: Want to open new window and then display print dialog for/in that window
body: <p>I have the following function being called onclick by an anchor. It opens the new window like I want but, the issue is that the print dialog box won't display unless the <code>'URL'</code> field of the open() function is empty. </p>
  
  <p>I need to be able to open a specific URL (<code>'https://www.example.com/file.pdf'</code>), so can't leave it blank.</p>
  
  <pre><code>&lt;script&gt;
    var pdfw;
    function printPdf() {
      // pull url
      url = document.getElementById('print').getAttribute('href');
      console.log("pull");
  
      // open window
      pdfw = window.open('', '_blank', 'fullscreen=1,channelmode=1,status=1,resizable=1');
      console.log("open");
  
      // print window
      pdfw.focus().print();
      console.log("print");
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>Brings up new window, which is blank because the URL isn't specificed of course, and print dialog box:</p>
  
  <pre><code>pdfw = window.open('', '_blank', 'fullscreen=1,channelmode=1,status=1,resizable=1');
  </code></pre>
  
  <p>Brings up new window displaying desired file, but does not display the print dialog box:</p>
  
  <pre><code>pdfw = window.open(url, '_blank', 'fullscreen=1,channelmode=1,status=1,resizable=1');
  </code></pre>
  
  <p>I would say it is some kind of race condition issue, but nothing else is using the print function on any of the pages the script runs on, so I'm pretty sure that's not it.</p>
  
  <p>Any help or advice with this issue would be greatly appreciated!</p>