Firefox Tomorrow

web api instance method

PreferenceObject: override property

View on MDN ↗

Limited availabilitySecure context

The override read-only property of the PreferenceObject interface returns the override of a preference if one is set, null otherwise.

Value

The override of the PreferenceObject interface, if set, or null if an override is not set.

Examples

Basic usage

This example demonstrates how to disambiguate between the color scheme preference set by the user agent vs a programmatic override.

if (navigator.preferences.colorScheme.override === null) {
  console.log(
    "The user agent set the following color scheme:",
    navigator.preferences.colorScheme.value,
  );
} else {
  console.log(
    "The following color scheme was set programmatically:",
    navigator.preferences.colorScheme.override,
  );
}

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.