Closed Thread Icon

Preserved Topic: auto redirect based on language in browser header (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18543" title="Pages that link to Preserved Topic: auto redirect based on language in browser header (Page 1 of 1)" rel="nofollow" >Preserved Topic: auto redirect based on language in browser header <span class="small">(Page 1 of 1)</span>\

 
tomeaglescz
Paranoid (IV) Inmate

From: Czech Republic via Bristol UK
Insane since: Feb 2002

posted posted 07-26-2002 13:13

ok i need some help...


I have to create a web site in french and english

the client wants if possible for the visitor to the web to be auto directed to french or english version based on the language settings of the browser.

I know in IE that the language is in the same section as the browser agent, anyone got any ideas on how to do this in ie and netscape

thx in advance

tom

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 07-26-2002 13:40

I did this quite a while back for http://www.dmsproject.com/wmwa/, and it's in no way fool-proof scince the browser can be in another language than os and other programs.

code:
function checkBrowser() {
//find out version and language of browser

var version = parseInt(navigator.appVersion);
var sprak = (navigator.browserLanguage);
//Swedish over 4
var svBr4 = (version >= 4) && (sprak == "sv");
//english over 4
var enBr4 = (version >= 4) && (sprak != "sv");
//all else under 4
var enBr3 = (version < 4);
//choose location
if (svBr4)
document.location.href="wmwaswedish.htm"
else if (enBr4)
document.location.href="wmwasite.htm"
else if (enBr3)
document.location.href="wmwa_v3.htm"
}


this is supposed to detect Swedish, if not pass it on to english.
Maybe it can help you.
/Dan

{cell 260}
-{ a vibration is a movement that doesn't know which way to go }-

tomeaglescz
Paranoid (IV) Inmate

From: Czech Republic via Bristol UK
Insane since: Feb 2002

posted posted 07-26-2002 13:55

Dan Thx for the quick reply will give it a shot and let you know, thx again

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 07-26-2002 17:52

Coincidentally, I found this: http://javascript.internet.com/user-details/language.html

Dunno if it helps....

Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 07-29-2002 14:35

you could have a radio button around the bottom that selects the language and if they select a new one, you could store it in a cookie...


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

tomeaglescz
Paranoid (IV) Inmate

From: Czech Republic via Bristol UK
Insane since: Feb 2002

posted posted 07-29-2002 15:10

thanks again guys ya turned up trumps as always

« BackwardsOnwards »

Show Forum Drop Down Menu