Siamak Motlagh
Siamak Motlagh

Reputation: 5146

Chrome extension, Store data

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.

Upvotes: 2

Views: 16625

Answers (3)

duckbrain
duckbrain

Reputation: 1279

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.

Upvotes: 3

T.J. Crowder
T.J. Crowder

Reputation: 1075467

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.

Upvotes: 24

wh1t30ps
wh1t30ps

Reputation: 11

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

Upvotes: 1

Related Questions