Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. NavigatorUAData

NavigatorUAData

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.

TheNavigatorUAData interface of theUser-Agent Client Hints API returns information about the browser and operating system of a user.

An instance of this object is returned by callingNavigator.userAgentData orWorkerNavigator.userAgentData. Therefore, this interface has no constructor.

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 byNavigatorUAData.getHighEntropyValues() 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.

Instance properties

NavigatorUAData.brandsRead onlyExperimental

Returns an array of brand information containing the browser name and version.

NavigatorUAData.mobileRead onlyExperimental

Returnstrue if the user-agent is running on a mobile device.

NavigatorUAData.platformRead onlyExperimental

Returns the platform brand the user-agent is running on.

Instance methods

NavigatorUAData.getHighEntropyValues()Experimental

Returns aPromise that resolves with a dictionary object containing thehigh entropy values the user-agent returns.

NavigatorUAData.toJSON()Experimental

Aserializer that returns a JSON representation of thelow entropy properties of theNavigatorUAData object.

Examples

Getting the brands

The following example prints the value ofNavigatorUAData.brands to the console.

js
console.log(navigator.userAgentData.brands);

Returning high entropy values

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

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

Specifications

Specification
User-Agent Client Hints
# navigatoruadata

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp