We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

window.navigator.language Redirect 1

« window


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


lang = window.navigator.language 


  • lang string representing the language version as defined in RFC 4646. Examples of valid language codes include "en", "en-US", "fr", "es-ES", etc.


if ( window.navigator.language != "en" ) {       


Specification Status Comment
HTML5 Web application
The definition of 'navigator.language' in that specification.
Working Draft Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support


Returns the browser UI language, not the value of the Accept-Language HTTP header.

1.0 (1.7 or earlier)

Prior to Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), this property's value was also part of the user agent string, as reported by navigator.userAgent.

Starting in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2), this property's value is based on the value of the Accept-Language HTTP header.


Closest available (non-standard) properties are userLanguage and browserLanguage.

IE11 provides navigator.language but it is unclear how many prior versions support it. Old versions are not available to me, at the moment.

(Yes) (Yes)
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) 1.0 (1.0)

Not supported

Closest available (non-standard) properties are userLanguage and browserLanguage.

(Yes) (Yes)

See also

Document Tags and Contributors

Last updated by: Sheppy,