Javascript 动态创建的锚标记单击方法不在internet Explorer 11中下载文件
锚定标签不会在IE中下载文件,而是提供了在应用商店中搜索应用以打开文件的选项。对于chrome和FF,此代码运行良好。我不知道这是否发生在windows 7中,因为我使用的是windows 8.1,windows 7没有应用程序选项Javascript 动态创建的锚标记单击方法不在internet Explorer 11中下载文件,javascript,jquery,windows,extjs,internet-explorer-11,Javascript,Jquery,Windows,Extjs,Internet Explorer 11,锚定标签不会在IE中下载文件,而是提供了在应用商店中搜索应用以打开文件的选项。对于chrome和FF,此代码运行良好。我不知道这是否发生在windows 7中,因为我使用的是windows 8.1,windows 7没有应用程序选项 var a = document.createElement("a"); a.href = filepath; a.download = filename; a.click(); 我们将非常感谢您的帮助。 谢谢。直接引用 Internet Explorer目前不支
var a = document.createElement("a");
a.href = filepath;
a.download = filename;
a.click();
我们将非常感谢您的帮助。
谢谢。直接引用
Internet Explorer目前不支持标签上的“下载”属性
见和;后者表示IE12“正在考虑”该功能。这可能有助于:
var blob = new Blob([response.responseText], { type: headers['content-type'] });
if (navigator.msSaveOrOpenBlob) {
//Launches the associated application for a File or Blob saving for non webkit based browser such as safari or IE
navigator.msSaveOrOpenBlob(blob, "cvSummary.xml");
}
else {
//code for webkit based browser
var link = document.createElement('a');
document.body.appendChild(link);
link.style = "display: none";
var url = window.URL.createObjectURL(blob);
link.href = window.URL.createObjectURL(blob);
link.download = "cvSummary.xml";
link.dataset.downloadurl = ["text/xml", link.download, link.href].join(':');
link.click();
window.URL.revokeObjectURL(url);
}