question

newuser-40cc112f-5ae8-46f2-b00e-a6ad037e5513 avatar image

web app - localstorage reliability

What are the guarantees for the browser's localStorage in Amazon web apps?

Setup:

  • webapp, provided as .zip and published in amazon app store
  • the app saves data in the browser's localStorage
  • Problem:
  • the localStorage is sometimes empty when the app is started (data is lost)

I can find no documentation.

Questions:

  1. Do I have to request the "storage" permission when accessing the browser's localStorage?
    1. I currently do not request that permission. There is no error, and the settings are mostly remembered.
  2. Can the localStorage be used for .zip-packaged amazon web apps?
  3. Are there any guarantees on the availability of the localStorage? E.g. across app updates, across device firmware updates.
    1. The data loss occurs also if the app was not updated in the meantime.

I suspect the app files are sometimes served from different locations (file:///amazon/abcde/index.html), and thus the browser uses a different localStorage due to same origin policy.

fire tabletamazon appstoreweb apps
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Brian@Amazon avatar image
Brian@Amazon answered
You are right about local storage being different for different origins. But why do you have different file paths for index.html? Do you have more than one index.html file? Also, you don't need any special permission to store data in browser local storage
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.