Script Categories













User Details >>> Language.

(Version 4.0+ browsers) Redirects a user to the page based on their language. For example, English language user browsers, which report the language as 'en' in most cases, can be redirected to an English page, while Spanish language user browser, which report the language as 'es' in most cases, can be sent to a separate Spanish page. This method works well for redirecting users in all the languages that you set up. Instructions on adding more languages are included in the source code.

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">      
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- 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) alert('You would have been taken to the English page.');
else if (language.indexOf('nl') > -1) alert('You would have been taken to the dutch page.');
else if (language.indexOf('fr') > -1) alert('You would have been taken to the french page.');
else if (language.indexOf('de') > -1) alert('You would have been taken to the german page.');
else if (language.indexOf('ja') > -1) alert('You would have been taken to the japanese page.');
else if (language.indexOf('it') > -1) alert('You would have been taken to the italian page.');
else if (language.indexOf('pt') > -1) alert('You would have been taken to the portuguese page.');
else if (language.indexOf('es') > -1) alert('You would have been taken to the Spanish page.');
else if (language.indexOf('sv') > -1) alert('You would have been taken to the swedish page.');
else if (language.indexOf('zh') > -1) alert('You would have been taken to the chinese page.');
else if (language.indexOf('ru') > -1) alert('Âû ìîãëè áûòü ïåðåíàïðàâëåíû íà Ðóññêóþ ñòðàíèöó.');
else
alert('You would have been taken to the default English page.  Your language was not set up.');
document.write("<b><br>Your language was reported as:  " + language+'</b>');
// End -->
</script>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

online casino


©