aplbrain / pyreconstruct-download

Tiny website + example code for downloading a subvolume for annotation in PyReconstruct
0 stars 0 forks source link

Change form submission to not redirect to new page #5

Open hannah-martinez opened 1 week ago

j6k4m8 commented 1 week ago

Can do this with a few lines of JS:

const a = document.createElement('a');
a.href = url;
a.download = 'annotations.json';
document.body.appendChild(a);
a.click();
URL.revokeObjectURL(url);

https://github.com/aplbrain/webpaint/blob/fcfe7d86408d78fc8036d00a5165f1960968b685/src/routes/standalone/%2Bpage.svelte#L53-L58