Language
The language read-only property of the Navigator interface returns a string representing the preferred language of the user, usually the language of the browser UI.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 1 | 12 | 1 | 1 | 18 | 1 | |
| The languages read-only property of the Navigator interface returns an array of strings representing the user's preferred languages. The language is described using a BCP 47 language tag. In the returned array they are ordered by preference with the most preferred language first. | 37 | 16 | 32 | 10.1 | 37 | 10.3 |
| The languagechange event is fired at the global scope object when the user's preferred language changes. | 37 | 79 | 32 | 10.1 | 37 | 10.3 |
| The languagechange event is fired at the global scope object when the user's preferred language changes. | 4 | 79 | 74 | | 18 | |
| The WorkerNavigator.language read-only property returns a string representing the preferred language of the user, usually the language of the browser UI. | 4 | 12 | 3.5 | 10 | 18 | 10 |
| The WorkerNavigator.languages read-only property returns an array of strings representing the user's preferred languages. The language is described using BCP 47 language tag. In the returned array they are ordered by preference with the most preferred language first. | 37 | 16 | 32 | 10.1 | 37 | 10.3 |
- Before Firefox 4, this property's value was also part of the user agent string, as reported by `navigator.userAgent`. Starting in Firefox 5, this property's value is based on the value of the `Accept-Language` HTTP header.
- Before Chrome 65, `navigator.languages[0]` is not guaranteed to equal `navigator.language`.
- In Firefox, the `navigator.languages` property's value is taken from the `intl.accept_languages` preference.
- Before Chrome Android 65, `navigator.languages[0]` is not guaranteed to equal `navigator.language`.
- Before Firefox 4, this property's value was also part of the user agent string, as reported by `navigator.userAgent`. Starting in Firefox 5, this property's value is based on the value of the `Accept-Language` HTTP header.
- Before Chrome 65, `navigator.languages[0]` is not guaranteed to equal `navigator.language`.
- In Firefox, the `navigator.languages` property's value is taken from the `intl.accept_languages` preference.
- Before Chrome Android 65, `navigator.languages[0]` is not guaranteed to equal `navigator.language`.
Use cases
-
Using Language
The language read-only property of the Navigator interface returns a string representing the preferred language of the user, usually the language of the browser UI.
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.