Putting a Download IE icon on the desktop or sticking it in the Welcome screen to launch an FTP session would again enable Microsoft to ship IE without including it in Windows, but we're not.
- How can I access the internet without a browser, my Internet Explorer has disappeared Hi - somehow my internet explorer has disappeared so I can't access the internet, and so I can't download it again!
- How to Run Programs without Installing them, from your Browser. Turbo.net is probably the fastest way to run applications from your browser without installing them, and includes more than 1000 apps. First, download the latest version of Zero Install from here.
I am a new bie, i want files to get downloaded when user clicks on download option its opening in the browser instead of download option like save as/open.Here i referred for the same and every where they have suggested to use
But i don't know where and how to use.Actually i'm getting the url value from query written which return url as one of the object of bean stored in arraylist(This list is having other values also with url ).I am having the url values inside the arraylist as bean as like
I am getting this array list in my controller like this
How To Download Another Browser
and pass this into view like this
in jsp i have iterated this array list and diplays the content like this
For download i have used like this in jsp
here on click of download its opening in browser.I need this to be downloaded instead.Please help me in how to use or handle
where to add the above for my requirement or if i can do with any java script also.Please help me in solving the above.
3 Answers
Here is one way of doing it:
- Create a web Filter (or this way )
- Map this filter to the PDF URL.
- In the
doFilter()
method, set the response header for content download.
Example :
You can set the filename as an request attribute (reqest.setAttribute()) from your controller class
How To Download A Browser Without A Browser
Filters are pretty standard in Java web stack.
It's depend on the header which browser get in response.
Suppose if header is image/png then browser will show it. Same way if you send same image with application/octet-stream then browser will force to download it.
take a look http://en.wikipedia.org/wiki/Byte_stream
In a project I have figure out that sending request from browser are different.
If you upload a image from Firefox or IE then it's will upload them as image/png wherever chrome upload them as application/octet-stream.
just try to add header
response.setHeader('Content-Type: application/force-download');