aje*_*rup 5 safari download ipad ios
我在Ipad + Safari中保存Excel文件时遇到问题。请注意,我唯一的问题是Ipad / Iphone IOS + Safari。
我用来实现“另存为”功能的库是 FileSaver.js,但它确实存在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);Run Code Online (Sandbox Code Playgroud)
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);Run Code Online (Sandbox Code Playgroud)
在以上所有解决方案中,到目前为止最好的一种:File Reader API。它确实可以正常工作,并且我可以使用正确的数据打开文件,但是唯一的问题是文件名,没有选项可以在新选项卡中打开。在Ipad + Safari中,文件名显示为“ unknown.xlsx”,这不是很好的用户体验。
如果可以解决文件名问题或任何其他库,请分享。
| 归档时间: |
|
| 查看次数: |
2217 次 |
| 最近记录: |