javascript - IE11 no download prompt, always tries to open -


i have function download text file server. works on chrome not work ie 11. please me. , regards.

        // file name url.         var filename = url.substring(url.lastindexof("/") + 1).split("?")[0];         var xhr = new xmlhttprequest();         xhr.open('get', url, true);         xhr.responsetype = 'blob ';          xhr.onload = function () {             var = document.createelement('a');             a.href = window.url.createobjecturl(xhr.response); // xhr.response blob             a.download = filename; // set file name.             a.style.display = 'none';             document.body.appendchild(a);             a.click();         };          xhr.send();         xhr.onerror = function (e) {             alert("error " + e.target.status + " occurred while receiving document.");         }; 


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -