View Full Version : Close Popup After Completion of Download

10-17-2006, 05:11 PM
I have a sized popup window that contains a link to a pdf file download and the password to open the downloaded pdf file (the file is encrypted). I want to automatically close the popup after the download is completed, but cannot use a timer for this since the downloads will vary in size from about 1-5 Mb. Closing the popup once the download link is clicked on will work though. I've looked through this forum and haven't found the correct code yet.

Many thanks for helping on this

Philip M
10-17-2006, 07:30 PM
I don't think thi is possible. JavaScript cannot read from or write to a file, nor communiacte with the server, nor can it tell whether or not a download has completed.

10-17-2006, 07:42 PM
Looking back at this, all I need is for the popup window to close by itself when the download link is clicked on. Of course, the download has to start also on the click.

My link is:

<b>File Name:</b> <a href="encPdf/enc_<%=(rsDownload.Fields.Item("pdfName1").Value)%>" target="_blank"><%=(rsDownload.Fields.Item("pdfName1").Value)%></a>

10-18-2006, 04:53 AM
You could use AJAX if you wanted to communicate with the server but that is just one more thing to learn.

Try this:

<b>File Name:</b>
<a href="encPdf/enc_<%=(rsDownload.Fields.Item("pdfName1").Value)%>" target="_blank" onclick="window.close()">

10-19-2006, 10:55 PM
Works great. Many thanks