Original idea is from this post
-
Open a tab and navigate to the website where you have content to export.
-
Open devtools and switch to the console tab.
-
Copy and paste the following snippet in the console and Chrome should ask you to save the output file
var obj = JSON.stringify(localStorage, null, 4)
var vLink = document.createElement('a')
vBlob = new Blob([obj], {type: "octet/stream"})
vUrl = window.webkitURL.createObjectURL(vBlob);
vLink.setAttribute('href', vUrl);
vLink.setAttribute('download', vUrl.split('/')[2] + '-export.json'); // give you the website name + "export.json"
vLink.click();
- Profit!
Yeah. It was Firefox. It works in chrome. Is there a way of having the file save dialogue with this like the load one so it's possible to name the file and decide where it will be downloaded to?
Both scripts don't work in Firefox. The first one does nothing but there are no errors. The second script returns a warning that it was prevented from running because there was no user interaction in Firefox. But they both work in edge and chrome. Just need the filebsave duologue for the save script.