我也遇到了。查看错误
const downloadFile = / @PURE / defineTaskApi(
API_DOWNLOAD_FILE,
({ url, header = {}, timeout = __uniConfig.networkTimeout.downloadFile }, { resolve, reject }) => {
var timer;
var xhr = new XMLHttpRequest();
var downloadTask = new DownloadTask(xhr);
xhr.open("GET", url, true);
Object.keys(header).forEach((key) => {
xhr.setRequestHeader(key, header[key]);
});
xhr.responseType = "blob";
xhr.onload = function() {
clearTimeout(timer);
const statusCode = xhr.status;
const blob = this.response;
let filename;
const contentDisposition = xhr.getResponseHeader("content-disposition");
在这里xhr.getResponseHeader("content-disposition");强制获取了这个header中的content-disposition
兄弟你解决没有。
3 个回复
DCloud_uniCloud_WYQ
这是个警告,这个警告本身不影响下载。可以看看有没有其他报错
c***@163.com
uniapp下载第三方存储图片报错Refused to get unsafe header "content-dispositio"怎么解决的老哥
阿全uniapp
我也遇到了。查看错误
const downloadFile = / @PURE / defineTaskApi(
API_DOWNLOAD_FILE,
({ url, header = {}, timeout = __uniConfig.networkTimeout.downloadFile }, { resolve, reject }) => {
var timer;
var xhr = new XMLHttpRequest();
var downloadTask = new DownloadTask(xhr);
xhr.open("GET", url, true);
Object.keys(header).forEach((key) => {
xhr.setRequestHeader(key, header[key]);
});
xhr.responseType = "blob";
xhr.onload = function() {
clearTimeout(timer);
const statusCode = xhr.status;
const blob = this.response;
let filename;
const contentDisposition = xhr.getResponseHeader("content-disposition");
在这里xhr.getResponseHeader("content-disposition");强制获取了这个header中的content-disposition
兄弟你解决没有。