Вопросы:
Ява скрипт для распределения траффика по языку браузера
Ответы:
Ява скрипт для распределения траффика по языку браузера
<!-- ONE STEP TO INSTALL LANGUAGE:
1. Copy the coding into the HEAD of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
if (navigator.appName == 'Netscape')
var language = navigator.language;
else
var language = navigator.browserLanguage;
/*-------------------------------------------------------------
Netscape instructions:
In Netscape, find the language you want to redirect by going to
Edit Menu --> Preferences...
Then click the '+' box next to 'Navigator' and click 'Languages'
Click 'Add' then find the languages you want and add them below.
---------------------------------------------------------------
Microsoft Internet Explorer instructions:
In MSIE, find the language you want to redirect by going to
Tools Menu --> Internet Options...
Then click the 'Languages' button near the bottom of the page.
Click 'Add' then find the languages you want and add them below.
-------------------------------------------------------------*/
if (language.indexOf('en') > -1) document.location.href = 'English.html';
else if (language.indexOf('nl') > -1) document.location.href = 'dutch.html';
else if (language.indexOf('fr') > -1) document.location.href = 'french.html';
else if (language.indexOf('de') > -1) document.location.href = 'german.html';
else if (language.indexOf('ja') > -1) document.location.href = 'japanese.html';
else if (language.indexOf('it') > -1) document.location.href = 'italian.html';
else if (language.indexOf('pt') > -1) document.location.href = 'portuguese.html';
else if (language.indexOf('es') > -1) document.location.href = 'Spanish.html';
else if (language.indexOf('sv') > -1) document.location.href = 'swedish.html';
else if (language.indexOf('zh') > -1) document.location.href = 'chinese.html';
else
document.location.href = 'English.html';
// End -->
</script>
<!-- Script Size: 1.95 KB -->