We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b6403b2 commit aaf8897Copy full SHA for aaf8897
isimip_data/metadata/assets/js/api/DatasetApi.js
@@ -92,13 +92,18 @@ class DatasetApi {
92
93
static downloadFile(file) {
94
if (file.file_url) {
95
- const iframe = document.createElement('iframe')
96
- iframe.style.display = 'none'
97
- iframe.src = file.file_url
98
- iframe.onload = function() {
99
- this.parentNode.removeChild(this)
100
- }
101
- document.body.appendChild(iframe)
+ fetch(file.file_url)
+ .then(response => response.blob())
+ .then(blob => {
+ const url = URL.createObjectURL(blob)
+ const a = document.createElement('a')
+ a.href = url
+ a.download = file.name
102
+ document.body.appendChild(a)
103
+ a.click()
104
+ document.body.removeChild(a)
105
+ URL.revokeObjectURL(url)
106
+ })
107
}
108
109
0 commit comments