rndme/download

A solution for ie9

Closed this issue · 0 comments

ghwyf commented

https://www.joshmcarthur.com/til/2019/02/13/javascript-based-file-downloads-in-ie9.html

    
    // IE 9
    if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
      var frame = document.createElement("iframe");
      frame.style.display = "none";
      document.body.appendChild(frame);

      frame.contentWindow.document.open("text/html", "replace");
      frame.contentWindow.document.write(blob);
      frame.contentWindow.document.close();

      frame.contentWindow.focus();
      frame.contentWindow.document.execCommand("SaveAs", true, fileName);
      document.body.removeChild(frame);
      return
    }