View Full Version : Popup File download window that closes when download button clicked
amccann
10-27-2007, 03:56 AM
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.
insanemonkey
10-27-2007, 04:17 AM
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...
amccann
10-27-2007, 04:21 AM
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)
insanemonkey
10-27-2007, 04:30 AM
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...
djr33
10-27-2007, 06:42 AM
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.
amccann
10-27-2007, 01:37 PM
Thanks guys for the fast responses! Very helpful with my thinking.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.