A client has website which he's written in a number of languages which are organised in separate directories. At the moment, the surfer is directed to the French home page, and can find the his/her language by clicking on flags.
The client wants to up a step by being able to detect the surfer's language just after the surfer has clicked on his search engine listing and have that surfer automatically directed to the correct language.
You may find this thread [webmasterworld.com] of interest. The consensus there seems to be that auto-detection of language is not a good idea in many cases. You can read the comments in the thread and judge for your self how they apply to your situation.
As to a script, I found this snippet tucked away (had to blow the dust off it!) It purports to do what you asked - that is, check for what "prefered language" was chosen in the browser setup. But I've never used it and can't vouch that it's dependable. In particular, it is an old script so I'm not sure that these are the current names for the object you need to check in more recent browsers.
[edited by: tedster at 7:22 am (utc) on Jan. 9, 2003]
each user can setup his browser, sothat the browser can tell the server which language is prefered. apache has this feature build in for example. in this case you only need to add the countrycode at the end of the document, if it's index.html for example, you name it index.html.fr for french, index.html.de for german etc. pp.
if you're using apache, take a look into the docs.
problem is: how many are aware that they can set their browser up so that the server gets information about the preferred language?
I've looked into the Apache automatic detection and found it wanting in everyday practical life. It's a great feature, *IF* users did select the language preference in their browsers - otherwise its problematic.
you can do the Apache serverside identification, but for safety's sake do also still offer the manual selection.