K
Karl
Hi there!
I have a big Problem with some Javascript:
On a website, i want to paste some "confirm", if the
visitor's browserlanguage is not "de".
when he confirm, he'll be redirected to the english-translation of
this page.
to store this information, because it's ugly to ask on every single
visit, if he want to switch to the translation.
but i can't find out, why the script isn't working.
i please you to look at the source and answer me, if you have some
solution(s).
thanks, karl!
<SCRIPT LANGUAGE="JavaScript">
<!--
var Count = 0;
if (navigator.appName == 'Netscape')
{ var Language = navigator.language }
else {
var Language = navigator.browserLanguage
}
var cookies = document.cookie.split(/; /);
for(var i = 0; i < cookies.length; i++)
{
cookies = cookies.split(/=/);
cookies[1] = unescape(cookies[1]);
if(cookies[0] == 'Count') Count = cookies[1];
if(cookies[0] == 'Language') Language = cookies[1];
if(cookies[0] == 'Benutzer') Benutzer = cookies[1];
}
//Here comes the Problem:
//if 1st time here (count = 0) AND language = de
//I tried a few methods but the script isn't working
if (Count = 0 && Language.indexOf('de') > -1)
{
var Benutzer=confirm ("Your " + navigator.appName + " Language
is " + Language + ".\n\Would you like to switch to the English
Version?\n\-Translated by Babelfish-")
if (Benutzer==true)
{
Benutzer = window.location="http://world.altavista.com/babelfish/trurl_load?url=http://members.chello.at/stefan.szeiler&lp=de_en";
}
else { Benutzer = window.location="#"; }
}
Count++;
//Expire of Cookies in 1 year
var Datum = new Date();
Datum.setFullYear(Datum.getFullYear() + 1);
var expires = "expires=" + Datum.toGMTString();
//Cookies write:
document.cookie = "Count=" + escape(Count) + "; " + expires;
document.cookie = "Language=" + escape(Language) + "; " + expires;
document.cookie = "Benutzer=" + escape(Benutzer) + "; " + expires;
// Ende -->
</script>
I have a big Problem with some Javascript:
On a website, i want to paste some "confirm", if the
visitor's browserlanguage is not "de".
when he confirm, he'll be redirected to the english-translation of
this page.
to store this information, because it's ugly to ask on every single
visit, if he want to switch to the translation.
but i can't find out, why the script isn't working.
i please you to look at the source and answer me, if you have some
solution(s).
thanks, karl!
<SCRIPT LANGUAGE="JavaScript">
<!--
var Count = 0;
if (navigator.appName == 'Netscape')
{ var Language = navigator.language }
else {
var Language = navigator.browserLanguage
}
var cookies = document.cookie.split(/; /);
for(var i = 0; i < cookies.length; i++)
{
cookies = cookies.split(/=/);
cookies[1] = unescape(cookies[1]);
if(cookies[0] == 'Count') Count = cookies[1];
if(cookies[0] == 'Language') Language = cookies[1];
if(cookies[0] == 'Benutzer') Benutzer = cookies[1];
}
//Here comes the Problem:
//if 1st time here (count = 0) AND language = de
//I tried a few methods but the script isn't working
if (Count = 0 && Language.indexOf('de') > -1)
{
var Benutzer=confirm ("Your " + navigator.appName + " Language
is " + Language + ".\n\Would you like to switch to the English
Version?\n\-Translated by Babelfish-")
if (Benutzer==true)
{
Benutzer = window.location="http://world.altavista.com/babelfish/trurl_load?url=http://members.chello.at/stefan.szeiler&lp=de_en";
}
else { Benutzer = window.location="#"; }
}
Count++;
//Expire of Cookies in 1 year
var Datum = new Date();
Datum.setFullYear(Datum.getFullYear() + 1);
var expires = "expires=" + Datum.toGMTString();
//Cookies write:
document.cookie = "Count=" + escape(Count) + "; " + expires;
document.cookie = "Language=" + escape(Language) + "; " + expires;
document.cookie = "Benutzer=" + escape(Benutzer) + "; " + expires;
// Ende -->
</script>