View Single Post
Old 09-24-2012, 11:24 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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?
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote