Difference between revisions of "Widget:DataExporter"
From LINKS Community Center
Line 61: | Line 61: | ||
// fetch('/api.php?' + exportParams.toString()); | // fetch('/api.php?' + exportParams.toString()); | ||
− | const dl = document.createElement('a'); | + | // const dl = document.createElement('a'); |
− | dl.href = 'https://links.communitycenter.eu/index.php/Special:Ask/' + exportUrl; | + | // dl.href = 'https://links.communitycenter.eu/index.php/Special:Ask/' + exportUrl; |
− | dl.download = 'export.' + formData.get('fileformat'); | + | // dl.download = 'export.' + formData.get('fileformat'); |
− | document.body.appendChild(dl); | + | // document.body.appendChild(dl); |
− | dl.click(); | + | // dl.click(); |
− | document.body.removeChild(dl); | + | // document.body.removeChild(dl); |
+ | |||
+ | fetch('https://links.communitycenter.eu/index.php/Special:Ask/' + exportUrl) | ||
+ | .then(res => res.blob()) | ||
+ | .then(blob => { | ||
+ | const file = window.URL.createObjectURL(blob); | ||
+ | window.location.assign(file); | ||
+ | }) | ||
// exportUrl = '/api.php?action=ask&format=spreadsheet&query=[[Category:Disaster Community Technology]]'; | // exportUrl = '/api.php?action=ask&format=spreadsheet&query=[[Category:Disaster Community Technology]]'; |