If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Browser Language Redirect

Ahoy!

I want to put this code in the head of my main index page so that it redirects to my translated pages only if the browser language is French, Spanish or German. If the browser language is anything else (including English) then I want it to remain on my main index page. I can't get it to work. It seems to want to redirect even if the language isn't "fr", "es" or "de". I'd really appreciate any help.

Thanks for replying. Trouble is I don't want it to redirect away from my main index page. I've tried variations of the script you've linked to but they all went into infinite loops. I need a script that redirects if and only if "fr", "es" and "de" are the browser languages. The script has to go in the head of my main (English) index page. Is this possible?

(I know there are better server-side solutions to this but unfortunately they're not an option for me.)

Thanks for replying. That's a clever script and I think it's just what I'm looking for but I can't get it to work. My site essentially only has one page (my index.html page). If a French, Spanish or German browser view my site I want to redirect them to mysite.com/fr.html, mysite.com/es.html or mysite.com/de.html. I want my default (English) page to continue to show mysite.com and not mysite.com/index.html. When I tried your script with a French browser it redirected to mysite-fr.com?? What am I doing wrong or is what I'm looking for not possible?

Having said that, it's important to remember that the browser's language setting does not necessarily represent the language that the current user prefers to read. You may want to find yourself some flag graphics...

Having said that, it's important to remember that the browser's language setting does not necessarily represent the language that the current user prefers to read. You may want to find yourself some flag graphics...

i want to use this script but i wish to do something like, if the browser lang is other than english, present another page.How do i do that?