I have a scenario where I open a popup window behind which some server side code generates an encrypted url for accessing a file on amazon web services. On completing the server side code I require to start downloading the file via the URL and also to close the popup window. An issue I have with this is determining when the download has completed. I'm not sure if this can be done.
If I do the following
window.location.href = myUrl;
javascript: setTimeout(window.close, 1000);
I can start the download and if it completes ok before 1 second then great, however I'd like to know when the download has completed and only close the window at that point.
Does anyone know if I can determine when the download has completed?
Thanks in advance for any help!