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 Downloading only after prompt... 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 "Downloading only after prompt..." Watch "Downloading only after prompt..." New topic

Downloading only after prompt...

Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
Hai All!
Consider this scenario...
I have HTML code to download some PDF file.. And PDF reader is installed in the client machine. Now when i tried to download this pdf on client machine it is directly opening in browser.
Is there anyway that i can control so that system prompts for Downloading before Opening..
This should be generic..That is to say not only for PDF but for all kinds of files..
Any suggestions are appreciable..
Connie Boyd
Ranch Hand

Joined: Feb 22, 2001
Posts: 73
I'm not sure if this will work for you, but we have done it in the past. If you remove the extension of the file, or give it a strange extension (on both the actual physical file to be downloaded and in the HREF of your html code), the browser will usually not know what to do with it and will prompt the user to download. In order to do this though, you should clearly indicate what kind of file you are pointing to so the user knows what he/she is getting.
Hope this helps.
I agree. Here's the link:
subject: Downloading only after prompt...
jQuery in Action, 3rd edition