我有一个有效的网址,我正尝试使用ajax进行下载。AJAX下载不能正常工作
下面的代码有什么问题?
url = "https://firebasestorage.googleapis.com/v0/b/analyst-3206a.appspot.com/o/research_reports%2FNt7cXdWHFlQuwRcy8wo4B49VNeD3%2Fa?alt=media&token=5521f889-2737-4433-a279-f04999cdff22"
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function(event) {
var blob = xhr.response;
};
xhr.open('GET', url);
xhr.send();
这个代码是没有错。你是什么意思'不工作'? –
我的意思是没有下载,它只是默默地运行到完成 – ishandutta2007
你的文件是一个'PNG'格式。看到它的标题:https://imgur.com/a/ZapGY。 –