Forum Moderators: open

Message Too Old, No Replies

Getting browser language settings

impossible in firefox

         

Jakotsu

7:51 am on Sep 17, 2006 (gmt 0)

10+ Year Member



IE provides the document.userLanguage property, while FireFox only provides document.language. This last one is simply the language of the broswer version, and NOT the user-defined langugage.

Question: What the heck for is the Language setting from Firefox, if it can't be accessed via Javascript? I have to admit those FF guys are sometimes much more stupid than the Ms development team.

Rambo Tribble

11:10 pm on Sep 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The reason FF doesn't support this is the same reason IE Mac doesn't; it is specific to the Windows OS. FF is cross platform, IE isn't.

jay5r

11:17 pm on Sep 17, 2006 (gmt 0)

10+ Year Member Top Contributors Of The Month



Firefox does give the user language(s) in the "Accept-Language" HTTP header. I'm surprised this info isn't available via Javascript.

jay5r

11:37 pm on Sep 17, 2006 (gmt 0)

10+ Year Member Top Contributors Of The Month



Did a little searching and you SHOULD be able to get the user's language in Firefox (some earlier versions had a problem, however).

window.navigator.language

Language is also part of navigator.userAgent

Relevant links are:

[webmasterworld.com...]
[developer.mozilla.org...]

Rambo Tribble

12:07 am on Sep 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Navigator.language is the browser language, however, not the OS language that is provided by userLanguage, derived from the userProfile, if present, but defaulting to the browserLanguage property if the userProfile isn't present. In fact, these are all properties of the navigator object.

Jakotsu

6:14 pm on Sep 19, 2006 (gmt 0)

10+ Year Member



I invite you guys to check out this page, which shows all available JS properties for any broswer:

[gtalbot.org...]

As you can see, only thing regarding language on there is navigator.language, which refers to the browser's language. The language specified at the internal settings must be accesible somewhere via JS, and of course that is still platform-independant, this has nothing to do with Window's regional settings.

[edited by: Jakotsu at 6:16 pm (utc) on Sep. 19, 2006]

Rambo Tribble

10:33 pm on Sep 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That page only lists the properties of the browser visiting it. If you visit it in a Mozilla-compatible browser, it will list navigator.language. If you visit it in IE 4+ it will list userLanguage, browserLanguage, and userProfile as properties of the navigator object.

Rambo Tribble

2:05 am on Sep 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually, I should have said, "any JavaScript-enabled browser downloading it", since the query of navigator object properties is done locally with JavaScript's for/in method.