web api instance method
PreferenceObject: requestOverride() method
Limited availabilitySecure context
The requestOverride method of the PreferenceObject interface sets an override value for a particular preference.
Syntax
requestOverrides(value)
Parameters
value- : The value to request an override with.
Return value
A Promise which resolves to undefined on success, or rejects on failure.
Exceptions
NotAllowedErrorDOMException- : Thrown if the given value is not allowed.
Examples
Basic usage
The following example requests an override of the colorScheme.
await navigator.preferences.colorScheme.requestOverride("dark");
console.log(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.