W3cubDocs

/Web APIs

NavigatorUAData

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

The NavigatorUAData interface of the User-Agent Client Hints API returns information about the browser and operating system of a user.

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

Note: The terms high entropy and low 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 by NavigatorUAData.getHighEntropyValues() could potentially reveal more information. These values are therefore retrieved via a Promise, allowing time for the browser to request user permission, or make other checks.

Instance properties

NavigatorUAData.brands Read only Experimental

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

NavigatorUAData.mobile Read only Experimental

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

NavigatorUAData.platform Read only Experimental

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

Instance methods

NavigatorUAData.getHighEntropyValues() Experimental

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

NavigatorUAData.toJSON() Experimental

A serializer that returns a JSON representation of the low entropy properties of the NavigatorUAData object.

Examples

Getting the brands

The following example prints the value of NavigatorUAData.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 the NavigatorUAData.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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
NavigatorUAData 90 90 No No 76 No No 90 No 64 No No
brands 90 90 No No 76 No No 90 No 64 No No
getHighEntropyValues 90 90 No No 76 No No 90 No 64 No No
mobile 90 90 No No 76 No No 90 No 64 No No
platform 93 93 No No 79 No No 93 No 66 No No
toJSON 93 93 No No 79 No No 93 No 66 No No

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData