I am generating the excel file in server side and writing it to the outpuststream with the following response headers.
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment;filename="+fileName);
In my client side : An ajax call to the servlet as shown :
Ext.Ajax.request({
url: 'GenerateReport',
method: 'GET',
params: {
'start_date': sd.getValue(),
'end_date':ed.getValue()
}
});
Browser shows following Response Headers :
My Issue : The Open and Save dialog prompt is not opening.What may be the problem.Please help me resolve this.Any help is appreciated.Thanks.
Try to open new window with appropriate URL instead of AJAX request.
To be sure the browser would prompt
Open
orSave
, you have to send binary content type. Otherwise the browser tries to open the downloaded file with an associated application. Some browsers (older IE i.e.) might still infer the associated application from the filename extension.