开发者

handling firefox extension prefrences across sessions

开发者 https://www.devze.com 2023-03-07 22:40 出处:网络
I\'m working on a firefox extention. I like to give s开发者_StackOverflow中文版ome options for the user, like setting background

I'm working on a firefox extention. I like to give s开发者_StackOverflow中文版ome 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号