I'm working on a very simple html page with 2 buttons. The idea is to download an application by clicking one of the buttons so that the .exe file pops up for the person to save/open and then the web page goes through to a thank you for downloading page. The other button will have the same function but for another version of the application. Is it possible to do that at all? Any help will be greatly appreciated.
-
Is that helping you? http://stackoverflow.com/questions/1012437/uses-of-content-disposition-in-an-http-response-header – miwoe Jun 06 '13 at 11:48
-
possible duplicate of [PHP generate file for download then redirect](http://stackoverflow.com/questions/822707/php-generate-file-for-download-then-redirect) – Quentin Jun 06 '13 at 13:09
2 Answers
You need to correct the content-type your webserver is sending. It sounds like it is claiming that the data is text/plain. My mime.types file suggests exe files should be application/x-msdos-program
If you are using Apache, see http://httpd.apache.org/docs/1.3/mod/mod_mime.html#addtype (or the similar page in the manual for the version you are using).

- 629
- 1
- 5
- 13
-
I'm not sure you understood what I'm asking. I'm not having a problem, I'm asking how, what I need to do, can be achieved. I *need* the .exe file to come up when I click the button and then I *need* the html page to redirect to another page. – AlisaM Jun 06 '13 at 11:55
This is going to be a bit hacky, but it should do what you need:
main.html:
<html>
<head>
<script type="text/javascript">
function changeFrm(){
document.getElementById("result").src="thanks.html";
document.getElementById("one").src="blankpage.html";
}
</script
</head>
<frameset>
<frame id="one" src="link.html">
</frame>
<frame id="result" src="blankpage.html">
</frame>
</frameset>
</html>
Your link.html should contain:
<a href="setup.exe" onClick="parent.changeFrm();">text</a>
What this does is, it displays 2 frames. When loading the page, the first frame contains the links to the files and the second is not visible to the naked eye, because it will just display a white page.
When clicking on a link, the file is made available for download + the content of the 2 frames is changed, so that the first one will be displayed as blank and the second will contain your thank you text.
All that having been said: Please refrain from using frames where possible.

- 2,410
- 2
- 21
- 37
-
Thank you. Does this mean I have to create blankpage.html? Also, how do I apply the links to the buttons so that it would make a connection with the frames? Do I use the button image between the frame tags? I will have 2 buttons on the page, which need to open different .exe files – AlisaM Jun 06 '13 at 13:56
-
Yes, you have to create blankpage.html too. Just leave it either blank or apply the background of the main page. If you need 2 seperate links, just add another `...` tag like the one above to your link.html file. As for the buttons, just put them, where I have put `text`. One button per `...` tag. ;) – LuigiEdlCarno Jun 06 '13 at 14:01
-
Ok. I'm so sorry if I'm being a complete idiot about this, I'm very new to all this. I've applied links to the 2 images that are used for the buttons (each button containing a link to a different version of the application .exe file) and inserted the script in the head, and replaced your thanks.html with the file name to my thank you page name. But when I add the frameset tags. etc after what do I substitute the link.html within the first frame tag? Or do I also need to create a link.html file, or is it the name of the actual page I'm working on? – AlisaM Jun 06 '13 at 14:18
-
@AlisaM Your links (including your buttons) go inside the link.html file. – LuigiEdlCarno Jun 06 '13 at 14:25
-
is the link.html a completely new file that I have to create or is it the actual page I'm working on? In the latter case, if I add the frame tags in the page I'm working on, then it'll link back to itself... – AlisaM Jun 06 '13 at 14:36
-
ah no. link.html is a new file. Sorry, I thought that was clear. – LuigiEdlCarno Jun 06 '13 at 14:39
-
Ok thank you. I think I got everything right but when I insert the frame bit into the main html file it jumps straight to link.html – AlisaM Jun 06 '13 at 14:43
-
-
No, when I add this following under : It automatically changes to link.html file in dreamweaver and a window comes up saying "frameset contains no rows or cols values. defaulting to 2 rows" – AlisaM Jun 06 '13 at 14:52
-
please put a ``tag between head and frameset and the closing body tag between the closing frameset and the closing html – LuigiEdlCarno Jun 06 '13 at 15:13
-
-
#Ah yes. Just saw, that frames are deprecated in html5, so you can either declare doctype html 4 in your main.html only, or you need to find another solution. Again. Frames are really, really bad practice in html, but I had no better idea how to solve your problem. – LuigiEdlCarno Jun 07 '13 at 06:14
-
thank you very much anyway! :) if anything, it was a great learning experience! – AlisaM Jun 07 '13 at 09:50