Automatically jump to the Chinese and English pages. PHP web pages automatically jump to Chinese and English pages based on different browser languages: www.gabion.cn when the visitor's browser language is Chinese, the Chinese version of the user's mophp web page will automatically jump to the Chinese and English pages based on the browser language.
Demo: http://www.gabion.cn
When the visitor's browser language is Chinese, the Chinese version is displayed.
Overseas users jump to the English page if the browser is not Chinese by default.
PHP code:
$ Lan = substr ($ HTTP_ACCEPT_LANGUAGE, 0, 5 );
If ($ lan = "zh-cn ")
Print (" ");
Else
Print (" ");
?>
HTML web pages automatically jump to multilingual pages based on different browser languages
In Add the following code.
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 the languages listed above
Else
Window. location. replace ('URL ')
Script
Guest demo: http://www.gabion.cn when the visitor browser language is Chinese language to enter the Chinese version of foreign users mo...