Home>

When the visitor's browser language is Chinese, enter the Chinese page,Foreign users will default to English pages if their browser is not Chinese.

<?php
$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=eng/index.htm ">");
?>

html pages automatically jump to multilingual pages depending on the browser language

In<head></head>Add the following code between.

The following is quoted:

<script>
var type=navigator.appname
if (type == "netscape")
var lang=navigator.language
else
var lang=navigator.userlanguage
//cut down to first 2 chars of country code
var lang=lang.substr (0,2)
//English
if (lang == "en")
window.location.replace ("url")
//Simplified Chinese
else if (lang == "zh-cn")
window.location.replace ("url")
//traditional Chinese
else if (lang == "zh-tw")
window.location.replace ("url")
//German
else if (lang == "de")
window.location.replace ("url")
//Except for the languages ​​listed above
else
window.location.replace ("url")
</script>
php
  • Previous Easily master Linux shutdown and restart commands
  • Next Analysis of Android File Manager (Project 1)