File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes force download of page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "force download of page" Watch "force download of page" New topic

force download of page

a chandra

Joined: Apr 22, 2001
Posts: 3
I want the user to be made to download a .txt file if he click on the download button. But, both netscape and ie open the page in the browser iwndow without giving the user an option to download the file.
Can I force the browser to pop up the save as option instead of opening the page in the browser.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4351

a chandra,
one way to do that would be to change the extention from .txt to something else(.text maybe?). the only problem with that approach is that the user might not realize it is really a .txt file. there might be a better way but I dont know of it.
I hate to say this but, your name does not comply with the Javaranch naming guidelines which can be found at
please register again with a valid name.
[This message has been edited by Randall Twede (edited July 07, 2001).]

Visit my download page
I agree. Here's the link:
subject: force download of page
It's not a secret anymore!