Been doing something similar with save files for my game. Line 1 is " const rawData =" and line 2 is all the state. Then the save button downloads document.documentElement.outerHTML with line 2 replaced by the current state. No server required. https://github.com/mcteamster/white/blob/main/src/lib/data.t...
I keep this bookmark in Chrome which lets me open an editor in a tab and Chrome maintains the state of the textarea even through reboots as long as you don't close the tab: data:text/html, Notepad html,body{margin:0;padding:0;}textarea{padding:10px;font-family:Courier;font-size:16px;height:100%;width:100%;border:none;outline:none;} document.getElementsByTagName('textarea')[0].focus()
[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...