Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. NavigatorUAData
  4. getHighEntropyValues()

NavigatorUAData: getHighEntropyValues() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

Note: This feature is available inWeb Workers.

ThegetHighEntropyValues() method of theNavigatorUAData interface is aPromise that resolves with a dictionary object containing thehigh entropy values the user-agent returns.

Note:The termshigh entropy andlow entropy refer to the amount of information these values reveal about the browser.The values returned as properties are deemed low entropy, and unlikely to identify a user.The values returned bygetHighEntropyValues() could potentially reveal more information.These values are therefore retrieved via aPromise, allowing time for the browser to request user permission, or make other checks.

Syntax

js
getHighEntropyValues(hints)

Parameters

hints

An array containing the hints to be returned, one or more of:

  • "architecture"
  • "bitness"
  • "formFactors"
  • "fullVersionList"
  • "model"
  • "platformVersion"
  • "uaFullVersion"Deprecated
  • "wow64"

Return value

APromise that resolves to an object containing some or all of the following values (based on the hints requested):

brands

Returns an array of objects containingbrand andversion specifying the browser brand and its version (the same information as provided byNavigatorUAData.brands).Note that this information can be sent to a server in theSec-CH-UA header (alow-entropy client hint).

mobile

Returnstrue if the user agent is running on a mobile device (the same information as provided byNavigatorUAData.mobile).Note that this information can be sent to a server in theSec-CH-UA-Mobile header (alow-entropy client hint).

platform

Returns a string describing the platform the user agent is running on, like"Windows" (the same information as provided byNavigatorUAData.platform).Note that this information can be sent to a server in theSec-CH-UA-Platform header (alow-entropy client hint).

architecture

A string containing the platform architecture. For example,"x86".Note that this information can be sent to a server in theSec-CH-UA-Arch header after the server explicitly requests it in theAccept-CH header.

bitness

A string containing the architecture bitness. For example,"32" or"64".Note that this information can be sent to a server in theSec-CH-UA-Bitness header if the server explicitly requests it in theAccept-CH header.

formFactors

An array of strings containing the form-factors of a device. For example,["Tablet", "XR"].Note that this information can be sent to a server in theSec-CH-UA-Form-Factors header if the server explicitly requests it in theAccept-CH header.

fullVersionList

An array of objects with properties"brand" and"version" representing the browser name and full version respectively.For example,{"brand": "Google Chrome", "version": "103.0.5060.134"}, {"brand": "Chromium", "version": "103.0.5060.134"}.Please note that one object may intentionally contain invalid information to prevent sites from relying on a fixed list of browsers.Note that this information can be sent to a server in theSec-CH-UA-Full-Version-List header if the server explicitly requests it in theAccept-CH header.

model

A string containing the model of mobile device. For example,"Pixel 2XL". If device is not a mobile device or if device model is not known,model will be"".Note that this information can be sent to a server in theSec-CH-UA-Model header if the server explicitly requests it in theAccept-CH header.

platformVersion

A string containing the platform version. Platform name itself is always available as low-entropy hintplatform. For example,"10.0".Note that this information can be sent to a server in theSec-CH-UA-Platform-Version header if the server explicitly requests it in theAccept-CH header.

uaFullVersionDeprecated

A string containing the full browser version. For example,"103.0.5060.134". Deprecated in favor offullVersionList.Note that this information can be sent to a server in theSec-CH-UA-Full-Version header if the server explicitly requests it in theAccept-CH header.

wow64

A boolean indicating if the user agent's binary is running in 32-bit mode on 64-bit Windows.Note that this information can be sent to a server in theSec-CH-UA-WoW64 header if the server explicitly requests it in theAccept-CH header.

Exceptions

NotAllowedErrorDOMException

Thrown if the user-agent decides that one or more of thehints requested should not be returned.

Examples

In the following example a number of hints are requested using thegetHighEntropyValues() method.When the promise resolves, this information is printed to the console.

js
navigator.userAgentData  .getHighEntropyValues([    "architecture",    "model",    "platformVersion",    "fullVersionList",  ])  .then((values) => console.log(values));

Specifications

Specification
User-Agent Client Hints
# dom-navigatoruadata-gethighentropyvalues

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp