Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File download box in IE 6.0 opening twice

 
Adwait Patankar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic