wood burning stoves 2.0*
The moose likes Servlets and the fly likes How can I bypass the download dialogue box while downloading a file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How can I bypass the download dialogue box while downloading a file." Watch "How can I bypass the download dialogue box while downloading a file." New topic
Author

How can I bypass the download dialogue box while downloading a file.

Fawad Ali
Ranch Hand

Joined: Dec 28, 2009
Posts: 112
Hi All,
I want to show an excel file in the browser. How can I bypass the download dialogue box and show it directly in the browser.


Regards, Fawad Ali.
Software Engineer, Stafona Inc. - My Blog
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

Set response content type to application/vnd.ms-excel , Don't add content-disposition header, and just write down the file to response steam. It will open up in browser instead of asking user to save.

[Servlet tutorial] [Servlet 3.0 Cook Book]
Pete Nelson
Ranch Hand

Joined: Aug 30, 2010
Posts: 147

Sudir Nim gives the best option, but keep in mind, the "save" dialog box is a function of the browser, and not the server. How the browser behaves when any file is accessed is based on the configuration of the browser.

With Sudir Nim's suggestion, the server gives a "hint" to the browser (it's not telling it to save via content-disposition), but it's still up to the browser to determine what to do.


OCPJP
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I bypass the download dialogue box while downloading a file.
 
Similar Threads
code to download file on clientside at "c:\Temp" folder
listening to windows dialogue events in javascript
How to download a file without save/open dialogue box ?
Any idea on Export an Excel Sheet in GWT
Filtering the file names