Back to Content

PreferenceObject: value property

files/en-us/web/api/preferenceobject/value/index.md

latest764 B
Original Source

{{APIRef("User Preferences API")}}{{SeeCompatTable}}{{SecureContext_Header}}

The value read-only property of the {{domxref("PreferenceManager")}} interface returns the override value of a preference if one is set, or the UA-defined value if an override value is not set.

Value

The override of the {{domxref("PreferenceObject")}} interface if one is set, or the UA-defined value otherwise.

Examples

Basic usage

This example demonstrates how to query the user's reduced motion preference.

js
if (navigator.preferences.reducedMotion.value === "reduce") {
  // The user prefers reduced motion.
} else {
  // The user has stated no preference regarding motion.
}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}