Fix export button on mobile browsers

Signed-off-by: Aurélien Bompard's avatarAurélien Bompard <aurelien@bompard.org>
parent f5132eaa
Pipeline #34302488 passed with stage
in 1 minute and 46 seconds
......@@ -67,12 +67,13 @@ class ExportButton extends Component {
e.preventDefault();
const blob = new Blob(this.makeData(), { type: "text/csv" });
const csvURL = window.URL.createObjectURL(blob);
window.open(csvURL);
// Allows setting the filename, but does not work on Firefox
//const tempLink = document.createElement('a');
//tempLink.href = csvURL;
//tempLink.setAttribute('download', 'talk.csv');
//tempLink.click();
const tempLink = document.createElement("a");
tempLink.setAttribute("href", csvURL);
tempLink.setAttribute("download", "talk.csv");
tempLink.setAttribute("target", "_blank");
document.body.appendChild(tempLink);
tempLink.click();
document.body.removeChild(tempLink);
};
render() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment