recursal/MDN huggingface dataset:
Navigator: taintEnabled() method
================================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

 The **`Navigator.taintEnabled()`** method always returns
 `false`.

 Tainting was a security method used by JavaScript 1.2. It has long been removed; this
 method only stays for maintaining compatibility with very old scripts.

Syntax
------


```js
taintEnabled()
```

### Parameters

None.

### Return value

Always returns `false`.

Specifications
--------------

| Specification |
| --- |
| HTML Standard # dom-navigator-taintenabled |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Navigator`
Navigator: language property
============================

The **`Navigator.language`** read-only property returns a string representing the preferred language of the user, usually the language of the browser UI.

Value
-----

A string representing the language version as defined in RFC 5646: Tags for Identifying Languages (also known as BCP 47). Examples of valid language codes include "en", "en-US", "fr", "fr-FR", "es-ES", etc.

Note that in Safari on iOS prior to 10.2, the country code returned is lowercase: "en-us", "fr-fr" etc.

Examples
--------

### Using Intl constructors to do language-specific formatting

The `Intl` constructors allow formatting content to match the rules of a given locale. You can pass `navigator.language` to them to format content in the locale corresponding to the user's preferred language:


```js
const date = new Date("2012-05-24");

const formattedDate = new Intl.DateTimeFormat(navigator.language).format(date);
```

Specifications
--------------

| Specification |
| --- |
| HTML Standard # dom-navigator-language-dev |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `navigator.languages`
* `navigator`
* `Intl`
Navigator: deviceMemory property
================================

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

 The **`deviceMemory`** read-only
 property of the `Navigator` interface returns the approximate amount of
 device memory in gigabytes.

 The reported value is imprecise to curtail fingerprinting. It's approximated by
 rounding down to the nearest power of 2, then dividing that number by 1024. It is then
 clamped within lower and upper bounds to protect the privacy of owners of very low-memory or
 high-memory devices.

Value
-----

A floating point number; one of `0.25`, `0.5`, `1`, `2`, `4`, `8`.

Examples
--------


```js
const memory = navigator.deviceMemory;
console.log(`This device has at least ${memory}GiB of RAM.`);
```

Specifications
--------------

| Specification |
| --- |
| Device Memory # sec-device-memory-js-api |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `Device-Memory` HTTP header
Navigator: javaEnabled() method
===============================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

This method always returns false.

Syntax
------


```js
javaEnabled()
```

### Parameters

None.

### Return value

The boolean value `false`.

Examples
--------


```js
if (window.navigator.javaEnabled()) {
  // code will never be executed; the condition is always false
}
```

Specifications
--------------

| Specification |
| --- |
| HTML Standard # dom-navigator-javaenabled |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
Navigator: userActivation property
==================================

The read-only **`userActivation`** property of the `Navigator` interface returns a `UserActivation` object which contains information about the current window's user activation state.

Value
-----

A `UserActivation` object.

Examples
--------

### Checking if a user gesture was recently performed

Use `UserActivation.isActive` to check whether the user is currently interacting with the page (Transient activation).


```js
if (navigator.userActivation.isActive) {
  // proceed to request playing media, for example
}
```

### Checking if a user gesture was ever performed

Use `UserActivation.hasBeenActive` to check whether the user has ever interacted with the page (Sticky activation).


```js
if (navigator.userActivation.hasBeenActive) {
  // proceed with auto-playing an animation, for example
}
```

Specifications
--------------

| Specification |
| --- |
| HTML Standard # dom-navigator-useractivation |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `UserActivation`
* `UserActivation.hasBeenActive`
* `UserActivation.isActive`
* Features gated by user activation
Navigator: getGamepads() method
===============================

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

 The **`Navigator.getGamepads()`** method returns an array of
 `Gamepad` objects, one for each gamepad connected to the device.

 Elements in the array may be `null` if a gamepad disconnects during a
 session, so that the remaining gamepads retain the same index.

Syntax
------


```js
getGamepads()
```

### Parameters

None.

### Return value

An `Array` of `Gamepad` objects, eventually empty.

### Exceptions

`SecurityError` `DOMException`

Use of this feature was blocked by a Permissions Policy.

Examples
--------


```js
window.addEventListener("gamepadconnected", (e) => {
  const gp = navigator.getGamepads()[e.gamepad.index];
  console.log(
    `Gamepad connected at index ${gp.index}: ${gp.id} with ${gp.buttons.length} buttons, ${gp.axes.length} axes.`,
  );
});
```

Specifications
--------------

| Specification |
| --- |
| Gamepad # dom-navigator-getgamepads |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Gamepad API
* Gamepad API
Navigator: plugins property
===========================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

 Returns a `PluginArray` object, listing the `Plugin` objects describing the plugins installed in the application.
 Named properties of the returned object are not enumerable (except in very old browser versions).

 Recent versions of the specification hard-code the returned list.
 If inline viewing of PDF files is supported the property lists five standard plugins.
 If inline PDF viewing is not supported then an empty list is returned.

**Note:** Use `Navigator.pdfViewerEnabled` to determine if inline viewing of PDF files is supported. Do not infer it from this property.

 The "five standard plugins" are those that developers have most commonly used to feature detect inline PDF viewing.
 Returning these ensures that legacy code can more reliably determine whether inline viewing is supported.
 However this approach is not recommended for new code because this property may eventually be removed.


Legacy browser versions also list plugins for Adobe Flash and PDF viewer extensions.

Value
-----

`plugins` is a `PluginArray` object used to access `Plugin` objects either by name or as a list of items.

The returned value is not a JavaScript array, but has the `length` property and supports accessing individual items using bracket notation (`plugins[2]`), as well as via `item(index)` and `namedItem("name")` methods.

If PDF inline viewing is supported this will contain entries for the following plugins:

* "PDF Viewer"
* "Chrome PDF Viewer"
* "Chromium PDF Viewer"
* "Microsoft Edge PDF Viewer"
* "WebKit built-in PDF"

If inline viewing of PDFs is not supported then an empty object is returned.

Examples
--------

This code shows how to check if PDF files can be displayed inline:


```js
if ("PDF Viewer" in navigator.plugins) {
  // browser supports inline viewing of PDF files.
}
```

Specifications
--------------

| Specification |
| --- |
| HTML Standard # dom-navigator-plugins |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
Navigator: vendorSub property
=============================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

 The value of the **`Navigator.vendorSub`** property is always
 the empty string, in any browser.

Value
-----

* The empty string
Specifications
--------------

| Specification |
| --- |
| HTML Standard # dom-navigator-vendorsub-dev |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
Navigator: getBattery() method
==============================

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

 The **`getBattery()`** method provides information about the system's battery.
 It returns a battery promise, which resolves with a `BatteryManager` object providing some properties to get the battery status also some events you can handle to monitor the battery status.
 This implements the Battery Status API; see that documentation for additional details, a guide to using the API, and sample code.

Since Chrome 103, the `Navigator.getBattery()` method of Battery Status API only expose to secure context.

**Note:** Access to this feature may be controlled by the `Permissions-Policy` directive `battery`.

Syntax
------


```js
getBattery()
```

### Parameters

None.

### Return value

A `Promise` that fulfills with a `BatteryManager` object which you can use to get information about the battery's state.

### Exceptions

`NotAllowedError` `DOMException`

Use of this feature was blocked by a Permissions Policy.

`SecurityError` `DOMException`

The User Agent does not expose battery information to insecure contexts and this method was called from an insecure context.

Examples
--------

This example fetches the current charging state of the battery and establishes a handler for the `chargingchange` event, so that the charging state is recorded whenever it changes.


```js
let batteryIsCharging = false;

navigator.getBattery().then((battery) => {
  batteryIsCharging = battery.charging;

  battery.addEventListener("chargingchange", () => {
    batteryIsCharging = battery.charging;
  });
});
```


For more examples and details, see Battery Status API.

Specifications
--------------

| Specification |
| --- |
| Battery Status API # dom-navigator-getbattery |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Battery Status API
* `Permissions-Policy` `battery` directive
Navigator: languages property
=============================

 The **`Navigator.languages`** read-only property
 returns an array of strings representing the user's preferred
 languages. The language is described using language tags according to
 RFC 5646: Tags for Identifying Languages (also known as BCP 47). In the returned
 array they are ordered by preference with the most preferred language first.

 The value of `navigator.language` is the
 first element of the returned array.

 When its value changes, as the user's preferred languages are changed a
 `languagechange` event is fired on the `Window` object.

 The `Accept-Language` HTTP header in every HTTP request from the user's
 browser uses the same value for the `navigator.languages` property except for
 the extra `qvalues` (quality values) field (e.g. `en-US;q=0.8`).

Value
-----

An array of strings.

Examples
--------

### Listing the contents of navigator.language and navigator.languages


```js
navigator.language; // "en-US"
navigator.languages; // ["en-US", "zh-CN", "ja-JP"]
```

### Using Intl constructors to do language-specific formatting, with fallback

The array of language identifiers contained in `navigator.languages` can be passed directly to the `Intl` constructors to implement preference-based fallback selection of locales, where the first entry in the list that matches a locale supported by `Intl` is used:


```js
const date = new Date("2012-05-24");

const formattedDate = new Intl.DateTimeFormat(navigator.languages).format(date);
```

Specifications
--------------

| Specification |
| --- |
| HTML Standard # dom-navigator-languages-dev |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `navigator.language`
* `navigator`
* `languagechange` event
* `Intl`
Navigator: userAgentData property
=================================

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

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

 The **`userAgentData`** read-only property of the `Navigator` interface returns a `NavigatorUAData` object
 which can be used to access the `User-Agent Client Hints API`.

Value
-----

A `NavigatorUAData` object.

Examples
--------

The following example prints the value of `NavigatorUAData.brands` to the console.


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

Specifications
--------------

| Specification |
| --- |
| User-Agent Client Hints # dom-navigatorua-useragentdata |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Improving user privacy and developer experience with User-Agent Client Hints
Navigator: credentials property
===============================

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

 The **`credentials`** property of the `Navigator`
 interface returns the `CredentialsContainer` interface, which exposes
 methods to request credentials. The `CredentialsContainer` interface also
 notifies the user agent when an interesting event occurs, such as a successful sign-in
 or sign-out. This interface can be used for feature detection.

Value
-----

The `CredentialsContainer` interface.

Examples
--------


```js
if ("credentials" in navigator) {
  navigator.credentials.get({ password: true }).then((creds) => {
    //Do something with the credentials.
  });
} else {
  //Handle sign-in the way you did before.
}
```

Specifications
--------------

| Specification |
| --- |
| Credential Management Level 1 # framework-credential-management |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
Navigator: getVRDisplays() method
=================================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The **`getVRDisplays()`** method of the `Navigator` interface returns a promise that resolves to an array of `VRDisplay` objects representing any available VR displays connected to the computer.

Syntax
------


```js
getVRDisplays()
```

### Parameters

None.

### Return value

A promise that resolves to an array of `VRDisplay` objects.

Examples
--------

See `VRDisplay` for example code.

Specifications
--------------

#### No specification found

No specification data found for `api.Navigator.getVRDisplays`.  
Check for problems with this page or contribute a missing `spec_url` to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* WebVR API homepage
Navigator: userAgent property
=============================

 The **`Navigator.userAgent`** read-only property returns the
 user agent string for the current browser.


**Note:** The specification asks browsers to provide as little information via this field as
 possible. Never assume that the value of this property will stay the same in future
 versions of the same browser. Try not to use it at all, or only for current and past
 versions of a browser. New browsers may start using the same UA, or part of it, as an
 older browser: you really have no guarantee that the browser agent is indeed the one
 advertised by this property.


 Also keep in mind that users of a browser can change the value of this field if they
 want (UA spoofing).


 Browser identification based on detecting the user agent string is
 **unreliable** and **is not recommended**, as the user agent
 string is user configurable. For example:

* In Firefox, you can change the preference `general.useragent.override` in
 `about:config`. Some Firefox extensions do that; however, this only changes
 the HTTP header that gets sent and that is returned by `navigator.userAgent`.
 There might be other methods that utilize JavaScript code to identify the browser.
* Opera 6+ allows users to set the browser identification string via a menu.
Value
-----

 A string specifying the complete user agent string the browser
 provides both in HTTP headers and in response to this and other related
 methods on the `Navigator` object.

 The user agent string is built on a formal structure which can be decomposed into
 several pieces of info. Each of these pieces of info comes from other navigator
 properties which are also settable by the user. Gecko-based browsers comply with the
 following general structure:
```

userAgent = appCodeName/appVersion number (Platform; Security; OS-or-CPU;
Localization; rv: revision-version-number) product/productSub
Application-Name Application-Name-version
```

Examples
--------


```js
alert(window.navigator.userAgent);
// alerts "Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape6/6.1"
```

Specifications
--------------

| Specification |
| --- |
| HTML Standard # dom-navigator-useragent-dev |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `User-Agent` HTTP header
Navigator: activeVRDisplays property
====================================

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

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

 The **`activeVRDisplays`** read-only property of the
 `Navigator` interface returns an array containing every
 `VRDisplay` object that is currently presenting
 (`VRDisplay.ispresenting` is `true`).

**Note:** This property was part of the old WebVR API. It has been superseded by the WebXR Device API.

Value
-----

An array of `VRDisplay` objects.

Examples
--------


```js
function showActive() {
  const displays = navigator.activeVRDisplays;
  for (const display of displays) {
    console.log(`Display ${display.displayId} is active.`);
  }
}
```

Specifications
--------------

This property was part of the old WebVR API that has been superseded by the WebXR Device API. It is no longer on track to becoming a standard.

Until all browsers have implemented the new WebXR APIs, it is recommended to rely on frameworks, like A-Frame, Babylon.js, or Three.js, or a polyfill, to develop WebXR applications that will work across all browsers [1].

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* WebVR API
Navigator: geolocation property
===============================

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

 The **`Navigator.geolocation`** read-only property returns a
 `Geolocation` object that gives Web content access to the location of the
 device. This allows a website or app to offer customized results based on the user's
 location.


**Note:** For security reasons, when a web page tries to access location
 information, the user is notified and asked to grant permission. Be aware that each
 browser has its own policies and methods for requesting this permission.


Value
-----

A `Geolocation` object.

Specifications
--------------

| Specification |
| --- |
| Geolocation API # dom-navigator-geolocation |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Geolocation API