This code works great on tablets and desktop, but when I try on iPhone it is not downloading any file. Please help
if (aData.ExternalUrl === "") {
this.oModel.read("/GetAttachmentBase64Set('" + aData.DocumentId + "')", {
success: function (oData, oResponse) {
oList.setBusy(false);
var dataURI = oData.EvAttachmentData;
if (Device.system.tablet ||Device.system.phone) {
window.open(dataURI, "_blank");
return;
}
dataURI = dataURI.substring(dataURI.indexOf(",") + 1);
var raw = window.atob(dataURI);
var rawLength = raw.length;
var array = new Uint8Array(new ArrayBuffer(rawLength));
for (var i = 0; i < rawLength; i++) {
array[i] = raw.charCodeAt(i);
}
var saveByteArray = (function () {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (data, name) {
var blob = new Blob(data, {
type: "octet/stream"
}),
url = window.URL.createObjectURL(blob);
a.href = url;
a.download = name;
a.click();
window.URL.revokeObjectURL(url);
};
}());
saveByteArray([array], aData.Filename);
oList.removeSelections();
},
This code works great on tablets and desktop, but when I try on iPhone it is not downloading any file. Please help