/    Sign up×
Community /Pin to ProfileBookmark

help me please…navigator.browserLanguage

Hi Everyone,

I’m dharyl from Philippines, I had a problem in knowing the user’s browser Language. I was asked to have an alert pop up when the user of the site is using other language than “en-us”.
I had this code below just to test what language setting should the page read from the user.
<script language=”JavaScript”>
var a = navigator.browserLanguage;
var b = navigator.userLanguage;
var c = navigator.systemLanguage;
alert(“browser language”);
alert(a);
alert(“user language”);
alert(b);
alert(“system language”);
alert(c);
</script>
navigator.browserLanguage –> en-us
navigator.systemLanguage –> en-us
navigator.userLanguage –> en-us

when I change my browser language from Tools>InternetOptions>General>Languages
results are the same:
navigator.browserLanguage –> en-us
navigator.systemLanguage –> en-us
navigator.userLanguage –> en-us

when I change my browser language from
Start>ControlPanel>RegionalandLanguageOptions>Regional Options tab
the value of userLanguage changes just as what I set:
navigator.browserLanguage –> en-us
navigator.systemLanguage –> en-us
navigator.userLanguage –> Ja

That means navigator.userLanguage is for this one
Start>ControlPanel>RegionalandLanguageOptions>Regional Options tab

Now my point is how would I get the value of language setting for this one?
Tools>InternetOptions>General>Languages

I guess what I really need to know is how to get/read/know the current value of browserLanguage of the user. That was really what I need.

Because I guess that’s what I need for my task to be done.
Hope you guys can help me on this.

Thanks in advance,
dha

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @dharyl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...