Preferences API

  • Revision slug: Preferences_API
  • Revision title: Preferences API
  • Revision id: 44054
  • Created:
  • Creator: Nickolay
  • Is current revision? No
  • Comment stub for an article about nsIPrefService APIs (to be linked from [[Building_an_Extension]])

Revision Content

Preferences API allows you save and read strings, numbers, booleans, and references to files to the preferences store. It is relatively easy to use, while providing a number of useful user and developer features, including support for default preferences, user overrides via user.js, and locking.

You can also create a XUL-based options window easily to allow user modify some preferences. Many applications including Firefox and Thunderbird have an additional tool for power users, about:config, which can be used to tweak the preferences without UI.

Interfaces

The preferences API is exposed as a set of frozen XPCOM components and interfaces: nsIPrefService, nsIPrefBranch, nsIPrefBranch2

...

External links

Revision Source

<p>Preferences API allows you save and read strings, numbers, booleans, and references to files to the preferences store. It is relatively easy to use, while providing a <a class="external" href="http://www.mozilla.org/catalog/end-user/customizing/briefprefs.html">number of useful user and developer features</a>, including support for default preferences, user overrides via user.js, and locking.
</p><p>You can also create a XUL-based <a href="en/Preferences_System"> options window</a> easily to allow user modify some preferences. Many applications including Firefox and Thunderbird have an additional tool for power users, <a class="external" href="http://kb.mozillazine.org/about:config">about:config</a>, which can be used to tweak the preferences without UI.
</p>
<h3 name="Interfaces"> Interfaces </h3>
<p>The preferences API is exposed as a set of frozen XPCOM components and interfaces: <a href="en/NsIPrefService">nsIPrefService</a>, <a href="en/NsIPrefBranch">nsIPrefBranch</a>, <a href="en/NsIPrefBranch2">nsIPrefBranch2</a>
</p><p><span class="comment">...</span>
</p>
<h3 name="External_links"> External links </h3>
<ul><li> <a class="external" href="http://xulplanet.com/tutorials/xulqa/q_prefs.html">Brief introduction to using Preferences API in your code at xulplanet.com</a>
</li><li> <a class="external" href="http://kb.mozillazine.org/Dev_:_Using_preferences">Detailed discussion of various aspects of prefs API at MozillaZine Knowledge Base</a>
</li></ul>
Revert to this revision