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 requestOverride method of the PreferenceObject interface sets an must be provided value for a particular preference.
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 on failure.
Exceptions
NotAllowedErrorDOMException-
Thrown if the given value is not allowed.
Examples
Basic usage
The following example requests an 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
| desktop | mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
requestOverride
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend
Tip: you can click/tap on a cell for more information.
- In development. Supported in a pre-release version.
- In development. Supported in a pre-release version.
- No support
- No support
- Experimental. Expect behavior to change in the future.