Page | Auto Jump
PHP Web page According to the visitor's browser language different automatically jump Chinese and English pages
When the visitor's browser language is Chinese, enter the Chinese page
Foreign user default browser is not Chinese to jump English page
PHP Code:
?
$lan = substr ($HTTP _accept_language,0,5);
if ($lan = = "ZH-CN")
Print ("<meta http-equiv= ' refresh ' content = ' 0; URL = Gb/index.htm ' > ');
Else
Print ("<meta http-equiv= ' refresh ' content = ' 0; URL = En/index.htm ' > ');
?>
HTML Web page According to the browser language of visiting this different automatic jump multilingual page
Add the following code between:
<script>
var type=navigator.appname
if (type== "Netscape")
var lang = Navigator.language
Else
var lang = Navigator.userlanguage
Cut down to 2 chars of country code
var lang = lang.substr (0,2)
English
if (lang = = "en")
Window.location.replace (' url ')
Chinese Simplified
else if (lang = = "ZH-CN")
Window.location.replace (' url ')
Chinese Traditional
else if (lang = = "ZH-TW")
Window.location.replace (' url ')
German
else if (lang = = "de")
Window.location.replace (' url ')
In addition to the languages listed above
Else
Window.location.replace (' url ')
</script>