Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

File download box in IE 6.0 opening twice

 
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
 
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
 
I am a man of mystery. Mostly because of this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!