I have created a servlet which displays all the files within a folder (present on server). The filenames displayed are all displayed in the form of links (using a href), so as to facilitate file download.
But when i click on the FileXYZ link, i want to download file, but unable to download. I am using:
function downloadfile(file){
var blob = new Blob(['\ufeff'], {type: 'application/vnd.ms-excel'});
window.navigator.msSaveOrOpenBlob(blob, fileName);
}
<a href="javascript:void(0);" onclick=downloadfile(file);>FileXYZ<a>
I think the 1st parameter ('\ufeff') of Blob object is not correct. What should that be ?