1

Possible Duplicate:
JavaScript for detecting browser language preference

Is it possible to find from a web app the language of the user computer/browser? I'm using html5 and js. I'm not searching for ipdatabases solutions, you may be able to find the country language but not the computer.

Community
  • 1
  • 1
Cristi Băluță
  • 1,295
  • 15
  • 27
  • Would [Localization - JavaScript for detecting browser language preference](http://stackoverflow.com/questions/1043339/javascript-for-detecting-browser-language-preference) be of use? – David Thomas Apr 16 '12 at 11:22

3 Answers3

3

maybe you're looking for window.navigator.language

Fabrizio Calderan
  • 120,726
  • 26
  • 164
  • 177
2

To do this from the server side, you can lookout for the "Accept-Language" header. This gives the user's preference of languages as set in the browser.

Other JS versions are not reliable.

Ramesh
  • 13,043
  • 3
  • 52
  • 88
1

Try this:

<script type="text/javascript">  
    var userLang = (navigator.language) ?     
    navigator.language : navigator.userLanguage;   alert ("The language is: " + 
        userLang);  
</script> 
citruspi
  • 6,709
  • 4
  • 27
  • 43