File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes File download box in IE 6.0 opening twice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "File download box in IE 6.0 opening twice" Watch "File download box in IE 6.0 opening twice" New topic
Author

File download box in IE 6.0 opening twice

Adwait Patankar
Greenhorn

Joined: Jan 30, 2006
Posts: 6
When we open an excel file thru IE 5.5 from my application
the file download dialog box open once but in IE 6.0 the same dialog box opening twice with a security warning "Some files can harm your computer ....."

After clicking "open" on second attempt it opens the excel file.

Any solution to avoid this ?

my code:

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=\""+runId+".xls\"");
response.setContentLength(byteArrayOutputStream.size());
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(byteArrayOutputStream.toByteArray(), 0, byteArrayOutputStream.size());
ouputStream.flush();
ouputStream.close();

where byteArrayOutputStream is output after exporting from jasper report.

Thanks in advance
Darren Edwards
Ranch Hand

Joined: Aug 17, 2005
Posts: 69
These are differences in the way the browsers choose to handle file downloads as you don't have direct control over them from the server.

If you want to try and get the same download behaviour in IE you could try changing the first line to

which will prevent IE detecting the file type. It may work, but is a bit of a hack however you look at it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File download box in IE 6.0 opening twice