|
|
Subject:
How do I let the user download a file then redirect them to another URL?
Category: Computers > Internet Asked by: lawrence246-ga List Price: $13.00 |
Posted:
20 Jun 2005 07:43 PDT
Expires: 20 Jul 2005 07:43 PDT Question ID: 535077 |
I have a web page where people do a download. The page is in php and I use the php command: header("Location: " .$downloadPath ); where $downloadPath is some relative URI to a file. This works fine on everything but Internet Explorer for the Macintosh. On everything else, the user gets a save as dialog box and gets to save the file. I now would like to change the web page so that it will first do a download of a file and then redirect the user to another web page, and I would like it to work for all browsers, Windows and Mac. I'd like to use .php code, though if you have an answer that relies on JavaScript and can show me how to call to JavaScript from php, that'd be fine too. So the sequence of events is: -- user clicks on a button -- user is prompted to save a file from our website. They do so. -- user is redirected to a separate URL. Thanks! |
|
There is no answer at this time. |
|
Subject:
Re: How do I let the user download a file then redirect them to another URL?
From: viedeveloper-ga on 20 Jun 2005 17:10 PDT |
Hi, This can be performed using a small trick, as follows: - place a 1px*1px hidden frame somewhere on that page where the user will click the button/link/whatever.. - load the PHP download page (that prompts to download) in the iframe so he gets the save-as box - redirect the "top" page to where you want.. This shall solve it. Example: 'assuming an iframe named 'testframe' <a href="download-me.exe" onclick="top.location.href='/redirect_target.html'; return true;" target="testframe">Download here</a> Wish you luck with this. |
Subject:
Re: How do I let the user download a file then redirect them to another URL?
From: zooglester-ga on 21 Jun 2005 08:48 PDT |
Hello, You need to create a link to point the page "i.e. download.php" that contains following code between <head> and </head> <script language="JavaScript"> <!-- location.href="/index.php?<?php echo $_GET['download_file']; ?>"; // --> </script> Hope that helps. Best regards, Nicolas |
Subject:
Re: How do I let the user download a file then redirect them to another URL?
From: emilk-ga on 26 Jun 2005 03:38 PDT |
i tell you the awfull truth, there is no such script for all browser (pc + mac) thats the reason why all companies like download.com, sourceforge.com do it in their ugly way ie: get user to download page, try to display a download dialog with js and for another group of browsers display a link to try save your answer money: i think this can be purchased overthere: http://www.stadtaus.com/en/php_scripts/download_center_lite/ but i have no experience with them |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |