Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2006
    Posts
    62
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Close Popup After Completion of Download

    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

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,919
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    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.

  • #3
    New Coder
    Join Date
    Feb 2006
    Posts
    62
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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>

  • #4
    DSB
    DSB is offline
    New Coder
    Join Date
    Mar 2006
    Posts
    33
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could use AJAX if you wanted to communicate with the server but that is just one more thing to learn.

    Try this:

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

  • #5
    New Coder
    Join Date
    Feb 2006
    Posts
    62
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Works

    Works great. Many thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •