This question is not about the jQuery.fn.ready()
.
I open a new window with window.open()
for file download, and wants to close the window after the download is started. Most browsers will continue the file download so I don't need to wait until the download is finished.
The problem is when I close the window with jQuery.fn.ready()
, the file download is skipped straight away.
Here is what I tried and failed:
var w = window.open(...);
$(w).load(); // failed
$(w.document).load(); // failed
$(w.document).contents().load(); // failed
$(w.document).contents().find('body').load(); // failed
EDIT:
Adding jsFiddle for easy demo: http://jsfiddle.net/vicary/Yjkt8/1
EDIT 2:
By Jonny Sooter's answer, updated jsFiddle with a working version http://jsfiddle.net/vicary/Yjkt8/4.