I have an issue with saving an excel file in Ipad + Safari.Please note, my only issue is with Ipad/Iphone IOS + Safari.
Library I'm using to implement the 'save as' functionality is FileSaver.js, but it does have this bug for Safari.
Solutions I tried so far :
- using HTML5 download attribute, but download attr is not supported in IOS Safari
var blob = new Blob([jx_s2ab(wbout)], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'});
var a = window.document.createElement("a");
a.href = window.URL.createObjectURL(blob);
a.download = "textexcel.xlsx";
a.target = "_blank"
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
- File Reader API
var blob = new Blob([jx_s2ab(wbout)], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'});
var reader = new FileReader();
reader.onload = function(e){
window.location.href = reader.result;
}
reader.readAsDataURL(blob);
Out of all the above solutions, best one so far: File Reader API. It is actually working and I'm able to open the file with correct data.But the only issue is with the file name and no option to open in new tab. In Ipad+Safari, the file name is showing as 'unknown.xlsx', Which is not a good user experience.
Please share if any fix is available for file name issue or any other library is available.