I'm designing a multi-lingual site (At this point English and Japanese) and I want to create a script to direct the visitor to the appropriate gateway and set the default as english.
If I test the following code on my browser (IE 5.0), I get directed to the default English site even though my os and browser language is set to Japanese.
but if I remove the default it properly goes to the Japanese.
What should I do to correct this?
What am I doing wrong?
Thanks in advance..
<script language="javascript">
<!--
function getlanguage(){
language=navigator.language;
if(language){language=language.substring(0,2);}
else{language="z";}
switch (language){
case "ja" :
window.location="jap.htm";
break;
case "en" :
window.location="eng.htm";
break;
default :
window.location="eng.htm";
}
}
// -->
</script>
If I test the following code on my browser (IE 5.0), I get directed to the default English site even though my os and browser language is set to Japanese.
but if I remove the default it properly goes to the Japanese.
What should I do to correct this?
What am I doing wrong?
Thanks in advance..
<script language="javascript">
<!--
function getlanguage(){
language=navigator.language;
if(language){language=language.substring(0,2);}
else{language="z";}
switch (language){
case "ja" :
window.location="jap.htm";
break;
case "en" :
window.location="eng.htm";
break;
default :
window.location="eng.htm";
}
}
// -->
</script>