MDN self-hosted library · e01.org

PreferenceObject: requestOverride() method

User Preferences API

User Preferences API

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

  • NotAllowedError DOMException
  • : 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

Browser compatibility