I need to download a csv file using javascript in IE 8 and IE9.I tried using window.open().
Here is my code:
var URI = 'data:text/csv;charset=utf-8,';
var fileName = "text.csv";
var testlink = window.open("about:blank", "_blank");
testlink.document.write(fileData); //fileData has contents for the file
testlink.document.close();
testlink.document.execCommand('SaveAs', false, fileName);
testlink.close();
This opens a new window and prompts to save the file.After saving the file,it returns back to the page.Instead of opening a blank page,I need to download the file by staying in the page