Redirection en fonction du langage
Bonjour,
j'ai utilisé le script suivant pour une version française et une version internationale :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| <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('fr') > -1) document.location.href = 'index_fr.htm';
else
document.location.href = 'index_US.htm';
// End -->
</script> |
En fait ce que je voudrais maintenant c'est :
si le langage est différent du français on va à la version internationale, sinon on reste ici.
On écrirait ça comment ?
Code:
if (language.indexOf('fr') <= -1) document.location.href = 'index_US.htm';
Merci pour votre aide
Paul