the Fetch request service is used. The backend service does not generate a specific file, but returns a byte stream, which can be used in Chrome in the following way, but is not compatible with the IE, help solution. (files are not required to be generated on the server; fetch is required due to project problems. )
fetch(url).then(res => res.blob().then(blob => {
var a = document.createElement("a");
var url = window.URL.createObjectURL(blob); // blob (blob )
var filename = res.headers.get("Content-Disposition");
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(url);
}));
=
A solution to IE10+ has been found, but it is not compatible with IE9 operations (;"_") solutions
fetch(url).then(res => res.blob().then(blob => {
var filename = res.headers.get("Content-Disposition");
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, filename);
}else {
var a = document.createElement("a");
var url = window.URL.createObjectURL(blob); // blob (blob )
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(url);
}
}));