function createObjectURL(object) { return (window.URL) ? window.URL.createObjectURL(object) : window.webkitURL.createObjectURL(object); } var xhr = new XMLHttpRequest(); // var formData = new FormData(); xhr.open('get','../a/User/user_dowload'); //xhr.setRequestHeader("access-token", sessionStorage.getItem('access-token')); xhr.responseType = 'blob'; xhr.onload = function (e) { var blob = this.response; var filename = '用户汇总' + getYmdHis() + ".xls"; // console.log(this.response) if (window.navigator.msSaveOrOpenBlob) { navigator.msSaveBlob(blob, filename); } else { var a = document.createElement('a'); var url = createObjectURL(blob); a.href = url; a.download = filename; document.body.appendChild(a); a.click(); window.URL.revokeObjectURL(url); } }; xhr.send(params);