here's the situation..
I'm trying to find a way to read the OS language so that I can set the language on my webpage. I've searched the web for such method but haven't been able to find one. Is there anyone who can tell how to do this.
var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
in FF3, navigator.language == "en-US" for me, but navigator.browserLanguage is empty...
Hi rnd me,
interesting fact you've got there. I've tried both options and this is my result.
In case of FF3 I'd have to use your option
Code:
navigator.language
.
In case of IE I'd have to use Quidam's version
Code:
navigator.browserLanguage
So all I have to do is combine those two options with kmatheeswar's input. Modify it so that it gets the browser type and voila.
Retrieve the browser type en based on that result retrieve the language
Bookmarks