简体   繁体   中英

Electron: localStorage on Windows is not working properly

Faced this situation: The application uses localStorage to save user settings. When saving, data is written to localStorage. I can even read them from there, everything is correct.

But at the same time, if you close the application window, and then open it again and log in as the same user, the data is not saved. I see this error only on Windows (tested on Windows 10) and only when using Electron. If I open the same application in a regular browser, the app works fine (saves and loads without any issues). Everything also works fine on a Mac (both Electron and a regular browser).

Has anyone encountered similar behavior?

I would recommend treating an Electron app as a desktop application rather a web browser. Explore using node's file system API fs to store user settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM