最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Chrome extension, Store data - Stack Overflow

programmeradmin5浏览0评论

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.

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.

Share Improve this question edited Jul 27, 2018 at 20:59 Ashley Mills 53.1k17 gold badges135 silver badges169 bronze badges asked Apr 18, 2013 at 20:57 Siamak MotlaghSiamak Motlagh 5,1367 gold badges46 silver badges66 bronze badges 2
  • 3 "I don't want to use Local Storage, because I do not want the behavior of SESSIONS" local storage != session storage – T.J. Crowder Commented Oct 8, 2014 at 7:29
  • Maybe he means cache. – c-an Commented Feb 4, 2019 at 23:22
Add a comment  | 

3 Answers 3

Reset to default 24

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.

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.

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

发布评论

评论列表(0)

  1. 暂无评论