vkGunasekaran
vkGunasekaran

Reputation: 6814

handling firefox extension prefrences across sessions

I'm working on a firefox extention. I like to give some options for the user, like setting background
color and others. I need to retrive these options for each tabs. Where should i can store the values?

how can i get around this issue?

Upvotes: 1

Views: 101

Answers (1)

Frédéric Hamidi
Frédéric Hamidi

Reputation: 262939

You can use the XPCOM interfaces to Firefox' preferences system:

var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                      .getService(Components.interfaces.nsIPrefService)
                      .getBranch("extensions.yourextension.");
prefs.setIntPref("yourPersistedValue", 42);

See this article for more information and code samples.

Alternatively, you can use SQLite. See this answer for details.

Upvotes: 2

Related Questions