Detect browser language in JavaScript

To detect a user’s preferred language, we may refer to several properties on navigator. Some are supported only in latest browsers, while some are proprietary and IE only.

Take a deep look on navigator

Currently we have the following properties available to us:

Property Chrome Firefox IE Edge Opera Safari
navigator.languages 32 32 x x x x
navigator.language Yes 1 11 Yes Yes Yes
navigator.userLanguage x x Yes x x x
navigator.browserLanguage x x Yes x x x
navigator.systemLanguage x x Yes x x x

The original article was published in