Results 1 to 6 of 6

Thread: Popup File download window that closes when download button clicked

  1. #1
    Join Date
    Oct 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Popup File download window that closes when download button clicked

    Hi:
    I am looking for advice as to how to do the following:

    1. On site A, we have a "download a file" button
    2. When the user clicks on that button, a new window opens with some html from site B
    3. The user can click on a download button in that new window to start downloading the file - the window closes when the download button is clicked.
    4. The user can also close the window by clicking on a normal window control (e.g. X in upper right corner).

    Any guidance/pointers appreciated.

  2. #2
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    what kind of file types...
    say you have a zip..
    you dont need to run it in a new window..
    try <a href="yourfile.zip">
    this will work...

    let me know what file type it is...
    Hey new design new look, goto xudas for personal webdsign help.. (:

  3. #3
    Join Date
    Oct 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the fast response.

    The file is an mp3 and we want the popup window to show information from site B about the mp3, the mp3, an ad, and the download button. I know how to create a popup window with an iframe to pull in the content from site B and have the download link work.

    My missing link is how to have the window close on clicking the download button (when the normal download behavior would take over)

  4. #4
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    try doing this..

    im not really good with javascript but im gonna try so just fool around and lets us know..

    download link..<a href="Iluvmusic.mp3" onclick='window.close();'>

    im not really sure but try that and see...
    Hey new design new look, goto xudas for personal webdsign help.. (:

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That would work....sorta.

    window.close() requires that the window was originally opened with javascript or it won't do anything for security reasons.

    linking to an mp3 file also won't download it. It will instead just play in the browser (for the configuration most users have).

    This is one case where it's easier and just better to let the user determine how they save the files.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Oct 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks guys for the fast responses! Very helpful with my thinking.

Bookmarks

Posting Permissions

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