On May 9, 9:27 am, iamaporkaho...@gmail.com wrote:
On May 8, 1:45 pm, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
iamaporkaho...@gmail.com a écrit :
The main page of the site has this script which determines the
language settings of the OS. This works fine for IE but not for
firefox. Is there any other codes which i have to insert to make sure
Firefox would be able to load it?
In JavaScript the normal attributes for navigator are :
alert( ' appCodeName : ' +navigator.appCodeName+
'\n appName : ' +navigator.appName+
'\n appVersion : ' +navigator.appVersion+
'\n cookieEnabled : ' +navigator.cookieEnabled
'\n javaEnabled() : ' +navigator.javaEnabled()+
'\n language : ' +navigator.language+
'\n IE userLanguage : '+navigator.userLanguage+
'\n platform : ' +navigator.platform+
'\n userAgent : ' +navigator.userAgent;
<script type="text/javascript">
function detectlang()
{
var lang=navigator.userLanguage
var lang = navigator.language || navigator.userLanguage;
var langs=navigator.systemLanguage
doesn't exists (except IE ?)
var langb=navigator.browserLanguage
doesn't exists (except IE ?)
if
((langs=="ar-sa"||lang=="ar-sa"||langb=="ar-sa"))
or :
if(lang == 'ar-sa' || lang.substring(0,2) = 'ar')
{window.location.reload("http://www.flynas.com/ara/index.html")}
else
{window.location.reload("http://www.flynas.com/eng/index.html")}
}
</script>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
I did as suggested and remove navigator.browserLanguage &
navigator.systemLanguage from the script. It is still not working for
firefox. The same issue remains whereby the firefox browsers just keep
loading and doesn't redirect it to the actual site
there was a little extra code given to you which you have not used.
just try calling the following code lang.htm and run it in firefox,
there are sometimes 2 places where language preference will appear,
but mostly it is 3 places.
<script type="text/javascript">
alert( 'appCodeName : ' +navigator.appCodeName+
'\n appName : ' +navigator.appName+
'\n appVersion : ' +navigator.appVersion+
'\n cookieEnabled : ' +navigator.cookieEnabled+
'\n javaEnabled() : ' +navigator.javaEnabled()+
'\n language : ' +navigator.language+
'\n IE userLanguage : '+navigator.userLanguage+
'\n platform : ' +navigator.platform+
'\n userAgent : ' +navigator.userAgent
);
//also did you see
var lang = navigator.language || navigator.userLanguage;
alert(lang);
</script>
that should be enough for you.
BTW stick to using recognised country/language codes, so once you have
found one, dont then redirect to
ara or eng
but to
ar or en
or if you have dialects use en-GB or en-US etc... it will make your
life easier to follow standards, see what trouble IE caused you by
having its own windows specific way of doing things.