Win a copy of Svelte and Sapper in Action this week in the JavaScript 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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: 40200
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • 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.
 
It will give me the powers of the gods. Not bad for a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic