Chrome extension, Store data
Solution 1
You could use chrome.storage.sync
or chrome.storage.local
(docs). Both are local storage (not session storage); sync
has the additional advantage that it syncs to the user's Google account if they've connected Chrome to it.
Solution 2
The following page lists the storage mechanisms in HTML5. WebSQL gives you a pretty good database for your javascript to use.
http://www.html5rocks.com/en/features/storage
UPDATE: It has been some time since I posted this. WebSQL has been dropped. Browsers will probably still continue to support it, but all the implementations have been SQLite. IndexedDB is the way to go now. I have used it and it is a little hard to get into, but works well for a client side database.
UPDATE AGAIN: Chrome changing things. See T.J. Crowder's Answer.
Solution 3
I believe this is a simple solution for you if you just want to save some settings. It also has some examples, hope it helps.
https://developer.chrome.com/extensions/storage.html
Siamak Motlagh
Updated on June 04, 2022Comments
-
Siamak Motlagh almost 2 years
I've read this question: Chrome Extensions & Javasctipy Database but I want an answer with more details and more clear.
How can I store some of my extension settings?
Is it possible to use a database to do such things with JavaScript?
Is there any good tutorial on it?
I don't want to use Local Storage, because I do not want the behavior of SESSIONS
Thanks.
-
McCee about 11 yearsWelcome to Stack Overflow! It would be better to post your examples here rather than using a link, for posterity's sake. Links can become broken, so better to have a record of it here.
-
Volatil3 about 8 yearsSo SQL like implementation will not be supported anymore? I am using WebSQL but somehow I can't even insert data into it via Extension nor it' viewable in INspector: stackoverflow.com/questions/36324096/…
-
duckbrain about 8 yearsWebSQL was dropped as a proposed standard. I would suggest using IndexedDB. You will find better cross-browser support for it, and it is less likely to be deprecated for Chrome extensions. I don't know of any plans to remove WebSQL from Chrome though, so you may be fine. programmers.stackexchange.com/questions/220254/…
-
c-an about 5 yearsWill it end after April? like Google+ service.
-
c-an about 5 yearsIs
IndexedDB
usable for the Chrome extensions now? -
T.J. Crowder about 5 years@ChanjungKim - No, they're completely unrelated.