// 下载
$.ajax({
url:window.SITE_CONFIG.baseUrl+'/sjyp/yqfx/exportWord',
method:'get',
responseType:'blob',
data:{
token:this.$cookie.get("zdtoken"),
fileName:row.bt
}
}).success(function(response, status, header, config, statusText){
var blob = new Blob([response], { type: 'application/vnd.ms-word' });
var fileName = row.bt + '.docx';
if (window.navigator.msSaveOrOpenBlob) {// For IE浏览器
navigator.msSaveBlob(blob, fileName);
} else { // For 其他浏览器
var objectUrl = URL.createObjectURL(blob);
var a = document.createElement('a');
document.body.appendChild(a);
a.setAttribute('style', 'display:none');
a.setAttribute('href', objectUrl);
a.setAttribute('download', fileName);
a.click();
URL.revokeObjectURL(objectUrl);
}
}).error(function(data,header,config,status){
console.log('error')
});
使用window.location.href在IE下有问题,不推荐