I wrote a JS code to download pdf and zip files into the browser. For pdf download everything works fine. But for zip download, it's not working for ISO(15.3.1) chrome and firefox. But this works fine for the safari browser. Before updating the version(15.1) it was working fine for all browsers. I also tried using https://github.com/eligrey/FileSaver.js but the same problem exists.
let req = new XMLHttpRequest();
req.open("POST", url);
req.responseType = "blob";
req.onreadystatechange = function () {
if (req.response != null && req.status === 200) {
let link = document.createElement('a');
link.href = URL.createObjectURL(req.response);
link.download = $currComponent.find(".downloadFileName").val() + "." + req.response.type.split("/")[1];
link.click();
link.remove();
}
};
req.send(JSON.stringify(data));
Here I added the code that I worked with.