This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
This will work!!
Posted by steven on July 11, 2001 at 12:37 PM
This sounds crazy, but I found the answer at http://www.phpbuilder.com/forum/archives/2/2001/4/2/131486
basically, do this: String fileName = "whatever.txt"; String sBrowser = ""+req.getHeader("User-Agent") ; boolean bIE55 = (sBrowser.toUpperCase().indexOf("MSIE 5.5")!=-1) ; log.debug("bIE55 = " + bIE55); if (bIE55){ res.setContentType("application/download; name=\""+ fileName+"\"") ; res.setHeader("Content-Disposition", "anything; filename="+ fileName + "\";") ; } else{ // download type = 'application/octet-stream' or 'application/x-zip-compressed' res.setContentType(downloadType+"; name=\""+fileName+"\"") ; res.setHeader("Content-Disposition","attachment; filename=\"" + fileName + "\";"); } I have not seen this NOT work on IE5.5. It's so wonderful that I feel like leaving work right now. Enjoy!
Replies:
|