By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,241 Members | 1,991 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,241 IT Pros & Developers. It's quick & easy.

How do I multiple tasks once the user click my download button.

P: 15
Dear friends,

I have a website that sells software. In my download page I have a
"download" button that once the user clicks it open the windows wizard to
/download/save/cancel the software. So far so good.

The download itself is down using the response.redirect (url of the file to download),
e.g. response.redirect("assets/setup.exe")

My question is how do i also redirect the user to a 'thank you' page once they clicked the "download" button automatically.

once the redirect take place to bring the download wizard it seem that I have lost
the option to do an additional redirect.

Help is appreciated.
Oct 26 '09 #1
Share this Question
Share on Google+
6 Replies


jhardman
Expert 2.5K+
P: 3,405
There are a couple ways to do this, but I haven't seen a really standard solution. One that I do see is go to a thank you screen which has a javascript download function. Another option is to go to a framed page and have the frame handle the download.

Jared
Oct 27 '09 #2

P: 15
Hi jhardman,

I was looking at something like microsoft doese when you click their download button, see:
http://www.microsoft.com/downloads/d...displayLang=en

in any case at the end of my thankyou.htm page I inserted the js:

<SCRIPT language="JavaScript">
document.location='/Assets/setup.exe'
</SCRIPT>

It worked fine however when I run the page the browser will block the download , IE will say:
"In order to proect your computer Internet Explorer blocked the download.. click here for options.."

I'm not trying to force the download however I wonder if there is better way just to get the download-wizard w/o going thru the browser yellow-block line.

Regards
Avi
Oct 28 '09 #3

jhardman
Expert 2.5K+
P: 3,405
I'm afraid that is IE's default behavior, they have been highly criticized for allowing too many safety workarounds, and this is their compromise. How does firefox handle it?

Jared
Oct 28 '09 #4

P: 15
firefox didn't bother me with the block, it just prompted me with the download wizard as it should. Once you get the wiz the customer can select 'cancel' if he is not sure about the download.

There must be a way around this hurdle, as Microsoft itself implemented it, see below link:
http://www.microsoft.com/downloads/d...displayLang=en

I wonder how...
Oct 28 '09 #5

GazMathias
Expert 100+
P: 197
Hi,

I am a big fan of jQuery.

In the below example, when the user clicks Download, the download begins and a function is fired to replace the content of a div with something else (rather than redirecting). You can use jQuery's AJAX functions to retrieve html from another page if you want.

So when the page loads, it displays "Download a file!", but when the link is clicked it displays "Thanks for downloading!".

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script src="inc/jquery.js"></script>
  4. <script type="text/Javascript">
  5. $(document).ready(function() {
  6.  
  7.         $("a#download").click(function() {
  8.             $("#content").html("Thanks for downloading!");
  9.         });
  10. });
  11. </script>
  12. </head>
  13. <body>
  14. <div id ="content">
  15. Download a file!
  16. </div>
  17. <br />
  18. <a id="download" href="somefile.zip">Download Now!</a>
  19. </div>
  20. </html>
  21. </body>
  22.  
Gaz.
Nov 2 '09 #6

Markus
Expert 5K+
P: 6,050
@vstud70
You can bet your lucky stars that Microsoft's IE will have Microsoft's websites flagged as 'safe'.
Nov 2 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.