I have a question - is there any way to initiate a download and AFTER the user has confirmed the download then redirect to another site?

Is something like that possible via ASP or another language commonly used for websites?

Bad PHP "user experience" scenario (In use right now)

  • a) User comes to site, clicks download button
  • b) Users sees "download" landing page, gets redirected after 5 seconds
  • c) Download starts on Thankyoupage

Good "user experience" scenario: (my dream solution, what I want)

  • a) User comes to site, clicks download button
  • b) Download starts immediately on landing page
  • c) Download confirmed, redirects now to thank you page

Any programming language is a go for this.

  • Why is PHP a bad user experience? All users will have to confirm the download with their browser unless they've set the browser to start all downloads without confirmation but that's unlikely. So how will you know if they click to start the download you don't have control of that button?
    – Anagio
    Nov 19, 2012 at 18:06
  • When you say "download confirmed", do you mean the "download is complete"?
    – MrWhite
    Nov 19, 2012 at 23:20

1 Answer 1


I do exactly this with javascript.

I have this in the header of my site:

    function SetUpRedirect(destination)
    return true;

My download links look like this:

<a href="/downloads/foo.exe" title="Download Foo" onclick="SetUpRedirect('foo.exe')" class="funky_button_class">Download Now!</a>

Then my download page (download.htm) takes the file parameter and records it to a database plus provides a static link to the download. It does this with some fairly trivial PHP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.