detecting user language in Chrome Browser, Mozilla and IE - Javascript Browser Object Model

Javascript examples for Browser Object Model:Navigator

Description

detecting user language in Chrome Browser, Mozilla and IE

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Browser Language detection</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from  ww  w.  j a  v  a2s  .  c o  m
console.log(window.navigator.language);//works both in Mozilla and chrome
console.log(navigator.language);//works both in Mozilla and chrome
console.log(navigator.userLanguage);// Works in IE
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials