Originally Posted by Old Pedant
It's a question of timing: It is completely dependent on WHEN things happen. In Firefox, apparently both of the calls happen before the window.close() completes. In MSIE, clearly that doesn't happen.
Once you call window.close() on the current window, there's no guarantee what code, if any, will run from that window. For that matter, once you do window.location, there is no guarantee any code from the prior location will be able to run.
I would suggest that the way to do this would be to use AJAX, instead of window.location, to generate the PDF file (and you can just ignore the return from the AJAX call, then), then do the window.open() for the new popup, then do the window.close().
By calling AJAX, you aren't depending on any timing of events.
And not to ask a silly question, but...instead of doing the window.open to create a new popup and then closing the current one, why not just use window.location to replace the current popup with the new one?
Cool. Thanks for the tips!
Honestly, I didn't know about it
I'm more of a backend programmer than a front-end developer. Just found out about that window.location.replace yesterday.