PreferenceObject: requestOverride() method

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The requestOverrides method of the PreferenceObject interface sets the must be provided value.

Syntax

js
requestOverrides(value)

Parameters

value

The value to request an override with.

Return value

A Promise which resolves to undefined on success, or rejects with ConstraintError DOMException on failure.

Examples

The following example requests the override of the must be provided.

js
await navigator.preferences.colorScheme.requestOverride("dark");
console.log(navigator.preferences.colorScheme.override);

Specifications

Specification
Media Queries Level 5
# request-override-method

Browser compatibility