Use Fetch to download files, IE is not compatible, ask for help!

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);
  } 
})); 
Mar.03,2021

try using XMLHttpRequest


how much should it be compatible with IE?
if it is IE10 or above, you can use Github's fetch polyfill: https://github.com/github/fetch

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf2392-31df8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf2392-31df8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?