Skip to content Skip to sidebar Skip to footer

Ie 9+ Download Attribute Workaround

I am trying to download a file from my web service. I need to pass complex meta data to the server to know how to download the file. Here is how Im able to accomplish that in eve

Solution 1:

If you're only concerned about recent browsers you might take a look at using FileSaver.js. When running on IE10+ it uses navigator.msSaveOrOpenBlob.

var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "blob";
xhr.onload = fuction (eventInfo) {
    if (this.status == 200) {
        var blob = this.response;

        // FileSaver.js usage:
        saveAs(blob, "filename.ext");

        // Or IE10+ specific:
        navigator.msSaveOrOpenBlob(blob, "filename.ext");
    }
};
xhr.send();

Post a Comment for "Ie 9+ Download Attribute Workaround"