问题
When developing normal Chrome Apps, I use the Chrome storage API to persist key-value pairs across sessions. This works great, and I want to do the same for a Single App Kiosk Mode app to be deployed on managed Chrome devices. However, it seems that chrome.storage.local
does not persist across executions of the app.
I wrote a test app illustrating this issue. Code here.
回答1:
note: this answer applies only to users of the Chrome Management Console
It turns out the issue had everything to do with a setting in the Chrome Management Console. Under Device Settings, the "User Data" option should be "Do not erase all local user data." I had set it to "Erase all local user data," which wiped out my localStorage with each reboot. I didn't look at that option closely since I figured Single App Kiosk Mode existed outside of a user session, so there was no user data to erase.
来源:https://stackoverflow.com/questions/30763720/persist-data-across-single-app-kiosk-mode-executions