当前位置: 动力学知识库 > 问答 > 编程问答 >

Chrome Extension loses indexeddb when removed and readded

问题描述:

I decided to use indexeddb to store data for a chrome extension I wrote. I've noticed that if I remove the extension and readd it, the data is lost.

Is there a way to persist the database across re-installations?

网友答案:

The apps docs (which also applies to extensions) recommend using storage.sync to handle persistence across re-installations, but the quota is very limited: 102,400 bytes. And it's not the same thing as indexeddb so some data processing would need to be done.

If your data is bigger than that I think the only solution is to sync your data manually with a server-side component, either your own or some other cloud-based solution like Firebase: https://www.firebase.com/blog/2013-03-06-power-your-chrome-extension-with-firebase.html

网友答案:

Indexeddb is temporary storage. https://developers.google.com/chrome/whitepapers/storage

Browser may clear data anytime as necessary.

Until persistent data storage is available, possibly in combine with quota management api, treat indexeddb data as temporary.

分享给朋友:
您可能感兴趣的文章:
随机阅读: