Save preferences on google chrome extions

Using firefox, I can save the extension settings with Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService);

What interface can I use to store settings in Chrome? And are they overwritten by extension?

thank

+3
source share
2 answers

You can use localStorage API. See http://code.google.com/chrome/extensions/options.html for an example of creating a settings page with this, but most simply you can do:

localStorage['foo'] = 'bar';   // Store data
var foo = localStorage['foo']; // Get data

This data will also not be deleted when updating updates.

+4
source

HTML5 (localStorage) .

coockies , ( ).

/ localStorage... Map, - JSON.stringify JSON.parse.

+1

Source: https://habr.com/ru/post/1735518/


All Articles