Hi, I was wondering if anyone knew of a script or maybe point me in the right direction on how to change the content on a site to the language of the persons browser. For example, if a person in Germany came to my site and their browser settings where in German, my content would be in German and not English. Thanks.
You can use something like this: <html> <head> <script type="text/javascript"> function f_languageJump() { var l_lang; if (navigator.userLanguage) // For Explorer l_lang = navigator.userLanguage; else if (navigator.language) // For FireFox l_lang = navigator.language; if (l_lang) { l_lang = l_lang.substring(0,2); } else { l_lang="z"; } // alert( "lang='" + l_lang + "'" ); var page = "http://www.yoursite.com/"; switch (l_lang) { case "es" : // Spanish page += "spanish_page.html"; break; case "en" : // English page += "english_page.html"; break; case "fr" : // French page += "french_page.html"; break; case "de" : // German case "it" : // Italian case "sv" : // Swedish default : page += "english_page.html"; break; } // alert( "page='" + page + "'" ); top.location = page; } </script> </head> <body onload=f_languageJump();> </body> </html> Code (markup):
Is there anyway to have it so that the browser detects the users area and changes the page content instead of going to a another page?
Yes, you can do it with dynamic html. Best way is with AJAX, but is not for beginners, and also that way is not SEO friendy.