File downloading
This commit is contained in:
parent
86cedf9531
commit
eaf5e2fb95
3 changed files with 14 additions and 8 deletions
|
|
@ -326,14 +326,15 @@ class Node {
|
|||
}),
|
||||
})
|
||||
.then(response=>{
|
||||
console.log(...response.headers);
|
||||
let match = response.headers.get('content-disposition').match(/filename="([^"]*)"/)
|
||||
fname = match[1]
|
||||
return response.blob()
|
||||
})
|
||||
.then(blob=>{
|
||||
let url = window.URL.createObjectURL(blob)
|
||||
let a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = "filename.xlsx";
|
||||
a.download = fname;
|
||||
document.body.appendChild(a); // we need to append the element to the dom -> otherwise it will not work in firefox
|
||||
a.click();
|
||||
a.remove(); //afterwards we remove the element again
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue