Not-a-web-developer-question: Would it make sense to add a module that replicated the localStorage data 'upstream' or somewhere, something like an rsync.net copy that could be sync'ed by the user before they blow the cache?
Code of bookmarklet:
javascript:(function() { var backup = {}; for (i = 0; i < localStorage.length; i++) { var key = localStorage.key(i); var value = localStorage.getItem(key); backup[key] = escape(encodeURIComponent(value)); } var json = JSON.stringify(backup); var base = btoa(json); var href = 'data:text/javascript;charset=utf-8;base64,' + base; var link = document.createElement('a'); link.setAttribute('download', 'backup.json'); link.setAttribute('href', href); document.querySelector('body').appendChild(link); link.click(); link.remove();})()
[0] https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_A... [1] https://caniuse.com/indexeddb