Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

share|improve this question
    
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 '12 at 18:06
    
When you say "download confirmed", do you mean the "download is complete"? –  w3d Nov 19 '12 at 23:20

1 Answer 1

up vote 1 down vote accepted

I do exactly this with javascript.

I have this in the header of my site:

    function SetUpRedirect(destination)
{
    setTimeout("window.location=\'http://www.foo.com/download.htm?file="+destination+"\'",3000);
    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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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