Firefox Tomorrow

web api interface

PreferenceManager

View on MDN ↗

Limited availabilitySecure context

The PreferenceManager interface of the User Preferences API provides access to PreferenceObject objects used to query and modify user preferences.

The PreferenceManager for the current document can be accessed via the preferences property.

The PreferenceManager interface inherits from EventTarget.

Instance properties

Examples

Basic usage

This example demonstrates how to query the user’s preferred color scheme.

if (navigator.preferences.colorScheme.value === "dark") {
  // The user prefers a dark color scheme.
} else {
  // The user prefers a light color scheme.
}

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.