当我单击名为save
的图标时,我就有此代码,它应该下载文件。
save.addEventListener('click',function(){
var url=save.getAttribute('url');
//console.log(url);
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function(event) {
var blob = xhr.response;
};
xhr.open('GET', url);
xhr.send();
});
相反,我在第xhr.send()
行出现了以下错误
Failed to load resource: the server responded with a status of 403 ()
它存储在URL的firestore中。 应用的cors规则看起来像
[
{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]
如何清除此错误