I am downloading a PDF from my server. I set the "Content-Disposition" as "attachment". Its working very fine is Firefox. But in IE8 its displayed as inline. Any quick pointers to resolve this issue ?
Edit:
I am using Springs to write the PDF byte array stream. And using JSP in the client side to display.
Client side:
I am using a dhtml grid and keeping an tag. The code in the grid looks like:
<a href='javascript:viewPDF(14)' target="_self" >View</a>
On click of this the method viewPDF gets invoked. I kept this code in my javascript file.
function viewPDF(id) {
$("#pdfID").val(id);
$("#myform").attr('action',url);
$("#myform").submit();
}
Server side code base:
ByteArrayOutputStream reportBAOS = getPDFByteArrayStream();/*This is my method which returns the byte array stream.*/
response.setContentType("application/pdf");
response.setHeader("Content-Disposition","attachment; filename=testfile");
response.setHeader("Pragma","Public");
response.setHeader("Cache-Control","must-revalidate,post-check=0,pre-check=0");
response.setHeader("Expires","0");
ServletOutputStream os = response.getOutputStream();
os.write(reportBAOS.toByteArray());
os.flush();
os.close();