简体   繁体   English

Chrome扩展程序和客户端数据库

[英]Chrome Extension and a Client-Side Database

I'm creating a Chrome Extension that needs to store some data for each user in a database .. for this, I used first Java Servlets to connect to a MySQL database and use it, but it's not very adequat in my case : I want to store the client data in a client database, not in the server. 我正在创建一个Chrome扩展程序,该程序需要在数据库中存储每个用户的一些数据..为此,我使用了第一个Java Servlet连接到MySQL数据库并使用它,但是在我的情况下它并不足够:我想要将客户端数据存储在客户端数据库而不是服务器中。

I googled that looking for a solution and I found a lot of technologies that provide that, but I am still confused with all the results I got. 我用谷歌搜索了一个解决方案,然后发现了很多技术可以提供这种解决方案,但是我仍然对我得到的所有结果感到困惑。 Can anyone help me in this ? 有人可以帮我吗? I need some advices. 我需要一些建议。

Thank you very much in advance. 提前非常感谢您。

It depends on the data size you want to store. 这取决于您要存储的数据大小。 If it is less than about 100KB, you can use chrome.storage.sync API. 如果小于100KB,则可以使用chrome.storage.sync API。 Also, if it is less than about 5MB, you can use chrome.storage.local API. 另外,如果小于5MB,则可以使用chrome.storage.local API。 Both APIs are simple key-value store. 这两个API都是简单的键值存储。 Also, you can use LocalStorage and SessionStorage . 另外,您可以使用LocalStorage和SessionStorage

If you want to get more large DB, you may use IndexedDB. 如果要获得更大的数据库,可以使用IndexedDB。 The available size will be changed dynamically. 可用大小将动态更改。 See: What are the storage limits for the Indexed DB on Google's Chrome browser? 请参阅: Google Chrome浏览器上的索引数据库的存储限制是多少?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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