wood burning stoves 2.0*
The moose likes JSP and the fly likes How to avoid open/Save dialog box while downloading? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to avoid open/Save dialog box while downloading?" Watch "How to avoid open/Save dialog box while downloading?" New topic
Author

How to avoid open/Save dialog box while downloading?

Shamu Somasundaram
Ranch Hand

Joined: Aug 25, 2004
Posts: 41
Hi,
Can anyone please tell me how to avoid the dialog box for Open/Save while downloading a file? I don't want the dialog box to appear when I click a link to download.
Thanks in adavnce.
Shanmugavel.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you set the Content-Disposition header using "inline" instead of "attachment" the browser will open the document and show it.
Of course, the client machine will have to have the appropriate application fo r showing the content.

IE: If you send a PDF and the user doesn't have a PDF viewer on their machine, they will be presented with the "download/open with" box.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Shamu Somasundaram
Ranch Hand

Joined: Aug 25, 2004
Posts: 41
Hi,
Thanks for your reply. But I don't want the file to be opened in the browser. It should open in Excel itself if the file is an excel sheet without the dialog box appearing.
Also if you use window.open to open a file in pop-up in Javascript, how will you avoid the Open/Save dialog box?


Thanks,
Shanmugavel.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Browser will search for that appropriate application, if found then it will open the document otherwise you will get a save file window.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
correct. It will open inside the browser if there's a registered plugin for it.
You have no control over that. And a good thing it is, if a website could launch applications at will on a client computer it could install any software it wanted on that computer. The consequences would be disastrous. Noone would be able to visit any website as doing so would leave them wide open to virusses, spyware, and a host of other baddies.


42
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to avoid open/Save dialog box while downloading?
 
Similar Threads
File download problem
Servlet downloading
How to avoid download open/Save dialog box?
Download option in JSP
problem with download dialog box