This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have some java code in a servlet that generates an "xyz file" an sends it to the browser. I want IE to open the file in the associated application without prompting for a file download. (IE 6 on Windows XP)
In Windows Explorer I went under - Tools - Folder Options - File Types - scroll down until you find xyz (the extension) - highlight it - Advanced - remove the check in Confirm after Download.
From what I have seen on the web this should work, but the "File Download" dialog box still pops up. I think this is because I am sending the file outside of the response stream. I am doing this so that I don't need to create an actual file that would need to be deleted.
Does anyone have a clever solution to get a file to open on a client PC in the default app without seeing the "File Download" prompt?
Here is a sample of the code generating the file in case that is what the problem is.
Make sure you set the correct content type, and set it to one which IE recognises as belonging to an application which can work inside the browser (like Excel or Acrobat reader). You may also have to make sure the filetype ends in the default extension for this filetype (used to need to set the servlet name to something.xls when sending CSV data to be opened by Excel in IE4, might no longer be needed).