Forum Moderators: open
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.
Is there a script available which will do this?
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.
<SCRIPT LANGUAGE="JavaScript1.2"><!--
if (navigator.appName == 'Netscape')
var language = navigator.language;
else
var language = navigator.browserLanguage;
//--></SCRIPT>
[edited by: tedster at 7:22 am (utc) on Jan. 9, 2003]
if you're using apache, take a look into the docs.
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.