• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

.csv files are opend in the same browser withour displaying the download dialog box.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In our web based application we are using windows XP SP-2 and IE 6.0
When the user clicks on the link related to CSV File generation, the generated file is directly displayed in the browser, from where its link was clicked, with prompting the user with the download dialog box as to whether he wish to "Open" the file or "Save" it.

The function which takes care of the download is as below :-

.
.
.
response.setContentType(strContent);
if (strFileType.equals(LCConstants.ACTION_XML))
{//if it is XML
response.setHeader("Content-Disposition",
"attachment;filename="+strFileName+".xml");
out = response.getOutputStream();
}
else
{//if it is CSV
response.setHeader("Content-Disposition",
"inline;filename="+strFileName+".csv");
out = response.getOutputStream();
}
out.println(strXMLOrCSV);
ByteArrayOutputStream byteStream=new ByteArrayOutputStream();
byteStream.writeTo(out);
byteStream.flush();
byteStream.close();
}//end of download()

The above code works fine for windows 2000.
If in the above code "inline" is changed to "attachment" then, it works fine in windowz XP but in window 2000 it pops up the download dialog box twice.

While I know about the "Confirm open after download" and "Browse in same
window" options that I can set for the file types,
is there any way to force IE to always ask to Open/Save a file, regardless of the extension?

can abody plz share their knowlegde with me.
Thank you.
Regards,
Sheetal...
 
author & internet detective
Posts: 42135
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sheetal,


Notice that the xml one is set to "attachment" and the csv one is set to "inline." This is what is causing one to be downloaded (like an attachment) and one to be displayed in the browser (inline.) Switching the cvs one to attachment will give you the desired behavior.
reply
    Bookmark Topic Watch Topic
  • New Topic