0

I have a web page that uses localStorage to save statistics about how I use it (which in turn affect how things are displayed).

When I use different devices however, that data is of course not available and the page uses its default formatting.

Is there some existing software that makes it easy (e.g. running a single command-line at each end) to copy the localStorage data to a different device?

Note:

  • I don't need the original to be updated by what happens on the other devices.
  • I know it can be done the hard way, by manually saving a JSON dump, copying it to a file, etc.
  • I know the whole problem can be avoided by using server-side storage, but the page also needs to work off-line.
4
  • You'll be better off saving the state server-side instead of local storage. Except for that, for which browsers? For which operating systems?
    – Alejandro
    Nov 11, 2022 at 17:17
  • localStorage is only standardized when used via JavaScript from within a web page. How the web browser stores the data is different for each web browser. So the only chance is to migrate the whole browser profile directory. For e.g. FireFox this is pretty simple.
    – Robert
    Nov 11, 2022 at 17:24
  • @Robert, I'd be using the same browser on all devices, and the data can be dumped and restored in JSON format. I'm asking whether someone has already written the code to do this. Nov 11, 2022 at 17:47
  • @Alejandro, it's implemented as localStorage as the page needs to work even when off-line. Nov 11, 2022 at 17:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.